]> andersk Git - splint.git/blobdiff - src/constraintExpr.c
Fixed off by one bug involving arrays initialized with a block of values.
[splint.git] / src / constraintExpr.c
index fc0f2214d5f0cb14ff9e0f81d526b41e8268a0ba..1da586cb40969261eec81b7839a47748ae3a176b 100644 (file)
@@ -1431,9 +1431,9 @@ static /*@only@*/ constraintExpr constraintExpr_simplifyunaryExpr (/*@only@*/ co
          BADEXIT;
        }
 
-      /* slight Kludge to hanlde var [] = { , , };
-      ** type syntax  I don't think this is sounds but it should be good
-      ** enough.  The C stanrad is very confusing about initialization
+      /* slight Kludge to handle var [] = { , , };
+      ** type syntax  I don't think this is sound but it should be good
+      ** enough.  The C standard is very confusing about initialization
       ** -- DRL 7/25/01
       */
       
@@ -1444,10 +1444,14 @@ static /*@only@*/ constraintExpr constraintExpr_simplifyunaryExpr (/*@only@*/ co
 
          len = constraintTerm_getInitBlockLength(cterm);
 
+         /* -- drl 12/08/2003 : decrementing to fix off by one error */
+
+         len--;
+
          temp = constraintExpr_makeIntLiteral (len );
          
          constraintExpr_free(c);
-         DPRINTF(( message("Changed too %q", constraintExpr_print(temp)
+         DPRINTF(( message("Changed to %q", constraintExpr_print(temp)
                            ) ));
          constraintExpr_free(exp);
          return temp;
This page took 0.271378 seconds and 4 git commands to generate.