]> andersk Git - splint.git/commitdiff
Made allocations involving sizeof work correctly (test/malloc.c).
authorevans1629 <evans1629>
Tue, 10 Jun 2003 05:58:24 +0000 (05:58 +0000)
committerevans1629 <evans1629>
Tue, 10 Jun 2003 05:58:24 +0000 (05:58 +0000)
Fixed implicit constraints for functions.

39 files changed:
src/Headers/clabstract.h
src/Headers/constraint.h
src/Headers/constraintExprData.h
src/Headers/constraintList.h
src/Headers/context.h
src/Headers/functionClauseList.h
src/Makefile.am
src/Makefile.in
src/cgrammar.c.der
src/cgrammar.y
src/clabstract.c
src/constraint.c
src/constraintExpr.c
src/constraintExprData.c
src/constraintGeneration.c
src/constraintList.c
src/constraintResolve.c
src/context.c
src/ctbase.i
src/ctype.c
src/exprChecks.c
src/exprNode.c
src/flags.def
src/functionClauseList.c
src/uentry.c
test/Makefile.am
test/Makefile.in
test/compdestroy.expect
test/constannot.expect
test/decl.expect
test/for.expect
test/malloc.c [new file with mode: 0644]
test/malloc.expect [new file with mode: 0644]
test/manual.expect
test/maxset.expect
test/moreBufferTests.expect
test/moreBufferTests2.expect
test/simplebufferConstraintTests.expect
test/sizeoftest.expect

index 169f7d1891d1fc5133d5ee1d4e0e8c4edfdffb2a..afa1455c065b451eb81d8405e7d9d6b9dc0d929c 100644 (file)
@@ -101,9 +101,9 @@ extern void declareStaticFunction (/*@only@*/ idDecl p_tid)
    */
    
 extern sRef checkbufferConstraintClausesId (uentry p_ue);
-extern void setImplictfcnConstraints (void);
+extern void setImplicitfcnConstraints (void);
 
-/*@observer@*/ constraintList  getImplicitFcnConstraints (void);
+/*@observer@*/ constraintList getImplicitFcnConstraints (void);
 
 /* end drl*/
 
index 8c82f9d78da088db56db39b088e114d73bc67e9b..57676f41a034d3878859db1c8c4ef54bbd7ed00c 100644 (file)
@@ -4,7 +4,7 @@
 
 typedef enum
 {
-  LT, LTE, GT, GTE, EQ, NONNEGATIVE, POSITIVE, CASTEQ
+  LT, LTE, GT, GTE, EQ, NONNEGATIVE, POSITIVE,
 }
 arithType;
 
index c034882c958890fc1abd19ef93321463d738db4f..e4a4bec378d39d2b4f35e036960dd8e20b33d267 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef __constraintExprData_h__
-
 #define __constraintExprData_h__
 
-
 typedef enum
 {
   BINARYOP_UNDEFINED,
@@ -18,7 +16,6 @@ typedef enum
  }
 constraintExprUnaryOpKind;
 
-
 typedef struct constraintExprBinaryOp_
 {
   constraintExpr expr1;
@@ -26,14 +23,12 @@ typedef struct constraintExprBinaryOp_
   constraintExpr expr2;
 } constraintExprBinaryOp;
 
-
 typedef struct constraintExprUnaryOp_
 {
   constraintExpr expr;
   constraintExprUnaryOpKind unaryOp;
 } constraintExprUnaryOp;
 
-
 typedef union constraintExprData
 {
   constraintExprBinaryOp binaryOp;
@@ -50,13 +45,17 @@ extern void constraintExprData_freeTerm (/*@only@*/ constraintExprData) ;
 
 extern constraintExprData constraintExprData_termSetTerm ( /*@returned@*/ /*@partial@*/ constraintExprData p_data, /*@only@*/ constraintTerm p_term);
 
-extern /*@observer@*/ constraintTerm constraintExprData_termGetTerm (/*@observer@*/ constraintExprData p_data) /*@*/;
+extern /*@exposed@*/ constraintTerm 
+constraintExprData_termGetTerm (/*@observer@*/ constraintExprData p_data) /*@*/;
 
-extern constraintExprUnaryOpKind constraintExprData_unaryExprGetOp (/*@observer@*/ /*@reldef@*/ constraintExprData p_data) /*@*/;
+extern constraintExprUnaryOpKind 
+constraintExprData_unaryExprGetOp (/*@observer@*/ /*@reldef@*/ constraintExprData p_data) /*@*/;
 
-extern /*@observer@*/ constraintExpr  constraintExprData_unaryExprGetExpr (/*@observer@*/ /*@reldef@*/constraintExprData p_data) /*@*/;
+extern /*@observer@*/ constraintExpr 
+constraintExprData_unaryExprGetExpr (/*@observer@*/ /*@reldef@*/constraintExprData p_data) /*@*/;
 
-extern constraintExprData  constraintExprData_unaryExprSetOp (/*@partial@*/ /*@returned@*/ constraintExprData p_data, constraintExprUnaryOpKind p_op);
+extern constraintExprData  
+constraintExprData_unaryExprSetOp (/*@partial@*/ /*@returned@*/ constraintExprData p_data, constraintExprUnaryOpKind p_op);
 
 extern constraintExprData  constraintExprData_unaryExprSetExpr (/*@partial@*/ /*@returned@*/ constraintExprData p_data,  /*@only@*/ constraintExpr p_expr);
 
index c9f455c0958a8cd637a32c9193bb157b4659c90a..5c826c9aa98cc0f1559058dfe03ddc17d6b4f8f6 100644 (file)
@@ -86,9 +86,6 @@ extern void constraintList_printError (constraintList p_s, /*@observer@*/ filelo
 extern constraintList constraintList_sort (/*@returned@*/ constraintList p_ret)
    /*@modifies p_ret@*/ ;
 
-extern void constraintList_castConstraints (constraintList p_c, ctype p_tfrom, ctype p_tto) 
-   /*@modifies p_c@*/ ;
-
 extern void constraintList_dump (/*@observer@*/ constraintList p_c,  FILE * p_f);
 
 /*@only@*/ constraintList constraintList_undump (FILE * p_f);
index 4d5929ec1866516f67bc7fa0fdfde55f9b1c9029..c8ba6c3c66b679982ad7db2331363a6f3bad16f2 100644 (file)
@@ -58,6 +58,8 @@ extern /*@observer@*/ cstring context_getTrueName (void) /*@*/ ;
 extern /*@observer@*/ cstring context_getLarchPath (void) /*@*/ ;
 extern /*@observer@*/ cstring context_getLCLImportDir (void) /*@*/ ;
 
+extern constraintList context_getImplicitFcnConstraints (uentry p_ue) /*@*/ ;
+
 extern bool context_checkExport (uentry p_e) /*@*/ ;
 extern bool context_checkGlobMod (sRef p_el) /*@*/ ;
 extern bool context_checkGlobUse (uentry p_glob);
@@ -340,13 +342,9 @@ extern valueTable context_createGlobalMarkerValueTable (/*@only@*/ stateInfo p_i
 extern int context_getBugsLimit (void) /*@*/ ;
 # define context_getBugsLimit()  ((int)context_getValue(FLG_BUGSLIMIT))
 
-extern ctype context_setLastStruct (/*@returned@*/ ctype p_s) /*@modifies internalState@*/;
-extern ctype context_getLastStruct (/*@returned@*/ /*ctype p_s*/) /*@modifies internalState@*/;
-
 /*drl added 2/4/2002*/
 
 extern bool context_inOldStyleScope (void) /*@*/ ;
-extern void context_setGlobalStructInfo (ctype p_ct, constraintList p_list) /*@modifies internalState@*/ ;
 
 /*drl added 3/5/2003*/
 
index 24ff040c02d76694abc08a9ae164515cfbe71fda..88603854ec84943b5069fa71edf09c8bf47aa99e 100644 (file)
@@ -49,7 +49,7 @@ extern /*@unused@*/ /*@only@*/ cstring functionClauseList_unparse (functionClaus
 extern void functionClauseList_free (/*@only@*/ functionClauseList p_s) ;
 
 functionClauseList 
-functionClauseList_setImplictConstraints (/*@returned@*/ functionClauseList p_s);
+functionClauseList_setImplicitConstraints (/*@returned@*/ functionClauseList p_s);
      
 /*@constant int functionClauseListBASESIZE;@*/
 # define functionClauseListBASESIZE MIDBASESIZE
index 635811c29dd55dd92623cbdd25d3e34414f798b0..86f467f04b599eb575119043ba280bc9fdfeef4f 100644 (file)
@@ -399,6 +399,9 @@ lintnew: splintme
 splintme: 
        ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude  $(OVERFLOWCHSRC) $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw -mts tainted
 
+splintmebounds: 
+       ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude  $(OVERFLOWCHSRC) $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw -mts tainted +bounds +impboundsconstraints
+
 splintmesupcounts: 
        ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude  $(OVERFLOWCHSRC) $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments  -fcnuse -incondefs -exportlocal -supcounts -constuse -mts file -mts filerw 
 
index be75a1a164bc6e547f26dc30f921ce1bf5a74051..dffda81e4fda0dda5473076ababaf1f13ce1ec2a 100644 (file)
@@ -1127,6 +1127,9 @@ lintnew: splintme
 splintme: 
        ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude  $(OVERFLOWCHSRC) $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw -mts tainted
 
+splintmebounds: 
+       ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude  $(OVERFLOWCHSRC) $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw -mts tainted +bounds +impboundsconstraints
+
 splintmesupcounts: 
        ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude  $(OVERFLOWCHSRC) $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments  -fcnuse -incondefs -exportlocal -supcounts -constuse -mts file -mts filerw 
 
index 500eb7b2d5c14fb4b3de8752a908ea6bc0452775..bd5ac4afbe665e470c073c35eda21f3280f0b0cd 100644 (file)
@@ -3582,14 +3582,14 @@ case 26:
      yyval.ntyp = idDecl_replaceCtype (yyvsp[-5].ntyp, ct);
 
      /*drl 7/25/01 added*/
-     setImplictfcnConstraints();
+     setImplicitfcnConstraints();
 
      DPRINTF((message("namedDeclBase PushType TLPAREN TRPAREN...:\n adding implict constraints to functionClause List: %s",
                      functionClauseList_unparse(yyvsp[0].funcclauselist)
                      )
              ));
      
-     fcl = functionClauseList_setImplictConstraints(yyvsp[0].funcclauselist);
+     fcl = functionClauseList_setImplicitConstraints(yyvsp[0].funcclauselist);
 
      idDecl_addClauses (yyval.ntyp, fcl);
 
@@ -3609,7 +3609,7 @@ case 27:
 case 28:
 {
      functionClauseList fcl;
-     setImplictfcnConstraints ();
+     setImplicitfcnConstraints ();
      clearCurrentParams ();
      yyval.ntyp = idDecl_replaceCtype (yyvsp[-6].ntyp, ctype_makeFunction (idDecl_getCtype (yyvsp[-6].ntyp), yyvsp[-3].entrylist));
 
@@ -3618,7 +3618,7 @@ case 28:
                      )
              )) ;
      
-     fcl = functionClauseList_setImplictConstraints(yyvsp[0].funcclauselist);
+     fcl = functionClauseList_setImplicitConstraints(yyvsp[0].funcclauselist);
 
      idDecl_addClauses (yyval.ntyp, fcl);
 
@@ -4775,7 +4775,7 @@ case 405:
 { sRef_clearGlobalScopeSafe (); ;
     break;}
 case 406:
-{ ctype ct; ct = declareStruct (yyvsp[-9].cname, yyvsp[-4].flist); context_setGlobalStructInfo(ct, yyvsp[0].conL); yyval.ctyp = ct; ;
+{ ctype ct; ct = declareStruct (yyvsp[-9].cname, yyvsp[-4].flist); /* context_setGlobalStructInfo(ct, $12); */ yyval.ctyp = ct; ;
     break;}
 case 407:
 { sRef_setGlobalScopeSafe (); ;
index e91de36edfd60b44f0966d3a1b504ead550c68e5..c9937b38a3346e16081eee7b82b7879bd4b22746 100644 (file)
@@ -409,14 +409,14 @@ namedDeclBase
      $$ = idDecl_replaceCtype ($1, ct);
 
      /*drl 7/25/01 added*/
-     setImplictfcnConstraints();
+     setImplicitfcnConstraints();
 
      DPRINTF((message("namedDeclBase PushType TLPAREN TRPAREN...:\n adding implict constraints to functionClause List: %s",
                      functionClauseList_unparse($6)
                      )
              ));
      
-     fcl = functionClauseList_setImplictConstraints($6);
+     fcl = functionClauseList_setImplicitConstraints($6);
 
      idDecl_addClauses ($$, fcl);
 
@@ -434,7 +434,7 @@ namedDeclBase
    functionClauses
    {
      functionClauseList fcl;
-     setImplictfcnConstraints ();
+     setImplicitfcnConstraints ();
      clearCurrentParams ();
      $$ = idDecl_replaceCtype ($1, ctype_makeFunction (idDecl_getCtype ($1), $4));
 
@@ -443,7 +443,7 @@ namedDeclBase
                      )
              )) ;
      
-     fcl = functionClauseList_setImplictConstraints($7);
+     fcl = functionClauseList_setImplicitConstraints($7);
 
      idDecl_addClauses ($$, fcl);
 
@@ -1472,7 +1472,7 @@ suSpc
    structDeclList  DeleteStructInnerScope { sRef_clearGlobalScopeSafe (); }
    TRBRACE 
    optStructInvariant 
-   { ctype ct; ct = declareStruct ($3, $8); context_setGlobalStructInfo(ct, $12); $$ = ct; } 
+   { ctype ct; ct = declareStruct ($3, $8); /* context_setGlobalStructInfo(ct, $12); */ $$ = ct; } 
  | NotType CUNION  newId IsType TLBRACE { sRef_setGlobalScopeSafe (); } 
    CreateStructInnerScope 
    structDeclList DeleteStructInnerScope { sRef_clearGlobalScopeSafe (); } 
index 6538a6dc7ab83efa62a22d32a5299a8caf84a129..3bf4168976dc029442c368b241b020d5b1a5cd70 100644 (file)
@@ -505,7 +505,7 @@ The current semantics are generated constraints of the form MaxSet(p) >= 0 and M
 unless the @out@ annotation has been applied to a parameter, then we only want to generate maxSet(p) > = 0
 */
 
-void setImplictfcnConstraints (void)
+void setImplicitfcnConstraints (void)
 {
   uentryList params;
   sRef s;
@@ -521,7 +521,7 @@ void setImplictfcnConstraints (void)
   
   uentryList_elements (params, el)
     {
-      DPRINTF (("setImplictfcnConstraints doing: %s", uentry_unparse(el)));
+      DPRINTF (("setImplicitfcnConstraints doing: %s", uentry_unparse(el)));
       
       if (uentry_isVariable (el))
        {
index 674dee58191b4e0c49312b8caaf44196783d3d0a..ac18923a630942e1a9b814252b4a18e16c75e358 100644 (file)
@@ -110,32 +110,35 @@ constraint makeConstraintParse3 (constraintExpr l, lltok relOp, constraintExpr r
 
 constraint constraint_copy (/*@temp@*/ /*@observer@*/ constraint c)
 {
-  constraint ret;
-
-  llassert (constraint_isDefined (c));
-
-  ret = constraint_makeNew ();
-  ret->lexpr = constraintExpr_copy (c->lexpr);
-  ret->ar = c->ar;
-  ret->expr =  constraintExpr_copy (c->expr);
-  ret->post = c->post;
-  /*@-assignexpose@*/
-  ret->generatingExpr = c->generatingExpr;
-  /*@=assignexpose@*/
-  
-  if (c->orig != NULL)
-    ret->orig = constraint_copy (c->orig);
-  else
-    ret->orig = NULL;
-
-  if (c->or != NULL)
-    ret->or = constraint_copy (c->or);
+  if (!constraint_isDefined (c))
+    {
+      return constraint_undefined;
+    }
   else
-    ret->or = NULL;
-
-  ret->fcnPre = c->fcnPre;
-  
-  return ret;
+    {
+      constraint ret = constraint_makeNew ();
+      ret->lexpr = constraintExpr_copy (c->lexpr);
+      ret->ar = c->ar;
+      ret->expr =  constraintExpr_copy (c->expr);
+      ret->post = c->post;
+      /*@-assignexpose@*/
+      ret->generatingExpr = c->generatingExpr;
+      /*@=assignexpose@*/
+      
+      if (c->orig != NULL)
+       ret->orig = constraint_copy (c->orig);
+      else
+       ret->orig = NULL;
+      
+      if (c->or != NULL)
+       ret->or = constraint_copy (c->or);
+      else
+       ret->or = NULL;
+      
+      ret->fcnPre = c->fcnPre;
+      
+      return ret;
+    }
 }
 
 /*like copy except it doesn't allocate memory for the constraint*/
@@ -203,8 +206,10 @@ static /*@notnull@*/  /*@special@*/ constraint constraint_makeNew (void)
 
 constraint constraint_addGeneratingExpr (/*@returned@*/ constraint c, /*@exposed@*/ exprNode e)
 {
-  
-  llassert (constraint_isDefined (c) );
+  if (!constraint_isDefined (c)) 
+    {
+      return c;
+    }
   
   if (c->generatingExpr == NULL)
     {
@@ -391,14 +396,20 @@ static constraint
 constraint_makeEnsuresOpConstraintExpr (/*@only@*/ constraintExpr c1, /*@only@*/ constraintExpr c2, 
                                        fileloc sequencePoint, arithType ar)
 {
-  constraint ret = constraint_makeNew ();
-  llassert (constraintExpr_isDefined (c1) && constraintExpr_isDefined (c2));
-  ret->lexpr = c1;
-  ret->ar = ar;
-  ret->post = TRUE;
-  ret->expr = c2;
-  ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint);
-  return ret;
+  if (constraintExpr_isDefined (c1) && constraintExpr_isDefined (c2))
+    {
+      constraint ret = constraint_makeNew ();
+      ret->lexpr = c1;
+      ret->ar = ar;
+      ret->post = TRUE;
+      ret->expr = c2;
+      ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint);
+      return ret;
+    } 
+  else
+    {
+      return constraint_undefined;
+    }
 }
 
 static constraint 
@@ -423,16 +434,7 @@ constraint_makeEnsuresOp (/*@dependent@*/ exprNode e1, /*@dependent@*/ exprNode
 
 constraint constraint_makeEnsureEqual (exprNode e1, exprNode e2, fileloc sequencePoint)
 {
-  if (FALSE) /* (!ctype_almostEqual (exprNode_getType (e1), exprNode_getType (e2))) */
-    {
-      /* If the types are not identical, need to be careful the element sizes may be different. */
-      //! return (constraint_makeEnsuresOp (e1, e2, sequencePoint, CASTEQ));
-      BADBRANCH;
-    }
-  else
-    {
-      return (constraint_makeEnsuresOp (e1, e2, sequencePoint, EQ));
-    }
+  return (constraint_makeEnsuresOp (e1, e2, sequencePoint, EQ));
 }
 
 /* make constraint ensures e1 < e2 */
@@ -555,25 +557,22 @@ constraint constraint_makeMaxSetSideEffectPostIncrement (exprNode e, fileloc seq
 
 void constraint_free (/*@only@*/ constraint c)
 {
-  llassert (constraint_isDefined (c));
-
-
-  if (constraint_isDefined (c->orig))
-    constraint_free (c->orig);
-  if ( constraint_isDefined (c->or))
-    constraint_free (c->or);
+  if (constraint_isDefined (c))
+    {
+      constraint_free (c->orig);
+      c->orig = NULL;
 
-  
-  constraintExpr_free (c->lexpr);
-  constraintExpr_free (c->expr);
+      constraint_free (c->or);
+      c->or = NULL;
 
-  c->orig = NULL;
-  c->or = NULL;
-  c->lexpr = NULL;
-  c->expr  = NULL;
+      constraintExpr_free (c->lexpr);
+      c->lexpr = NULL;
 
-  free (c);
-  
+      constraintExpr_free (c->expr);
+      c->expr  = NULL;
+      
+      free (c);
+    }
 }
 
 cstring arithType_print (arithType ar) /*@*/
@@ -596,9 +595,6 @@ cstring arithType_print (arithType ar) /*@*/
     case EQ:
       st = cstring_makeLiteral ("==");
       break;
-    case CASTEQ:
-      st = cstring_makeLiteral ("(!)==");
-      break;
     case NONNEGATIVE:
       st = cstring_makeLiteral ("NONNEGATIVE");
       break;
@@ -815,7 +811,7 @@ cstring  constraint_unparseDetailed (constraint c)
   cstring genExpr;
   bool isLikely;
    
-  llassert (constraint_isDefined (c) );
+  llassert (constraint_isDefined (c));
    
   if (!c->post)
     {
@@ -826,17 +822,17 @@ cstring  constraint_unparseDetailed (constraint c)
       st = message ("Block Post condition:\nThis function block has the post condition %q", constraint_unparseDeep (c));
     }
 
-  isLikely = constraint_isConstantOnly(c);
+  isLikely = constraint_isConstantOnly (c);
 
   if (isLikely)
     {
       if (constraint_hasMaxSet (c))
        {
-         temp = cstring_makeLiteral ("Likely out-of-bounds store:\n");
+         temp = cstring_makeLiteral ("Likely out-of-bounds store: ");
        }
       else
        {
-         temp = cstring_makeLiteral ("Likely out-of-bounds read:\n");
+         temp = cstring_makeLiteral ("Likely out-of-bounds read: ");
        }
     }
   else
@@ -844,11 +840,11 @@ cstring  constraint_unparseDetailed (constraint c)
       
       if (constraint_hasMaxSet (c))
        {
-         temp = cstring_makeLiteral ("Possible out-of-bounds store:\n");
+         temp = cstring_makeLiteral ("Possible out-of-bounds store: ");
        }
       else
        {
-         temp = cstring_makeLiteral ("Possible out-of-bounds read:\n");
+         temp = cstring_makeLiteral ("Possible out-of-bounds read: ");
        }
     }
   
@@ -996,41 +992,43 @@ constraint constraint_doFixResult (constraint postcondition, /*@dependent@*/ exp
 
 constraint constraint_preserveOrig (/*@returned@*/ constraint c) /*@modifies c @*/
 {
-  DPRINTF (("Doing constraint_preserverOrig for %q", constraint_printDetailed (c)));
-  llassert (constraint_isDefined (c));
-
-  if (c->orig == constraint_undefined)
+  if (constraint_isDefined (c))
     {
-      c->orig = constraint_copy (c);
-    }
-  else if (c->orig->fcnPre)
-    {
-      constraint temp = c->orig;
+      DPRINTF (("Doing constraint_preserverOrig for %q", constraint_printDetailed (c)));
       
-      /* avoid infinite loop */
-      c->orig = NULL;
-      c->orig = constraint_copy (c);
-      /*drl 03/2/2003 if c != NULL then the copy of c will != null*/
-      llassert (constraint_isDefined (c->orig) );
-
-      if (c->orig->orig == NULL)
+      if (c->orig == constraint_undefined)
+       {
+         c->orig = constraint_copy (c);
+       }
+      else if (c->orig->fcnPre)
        {
-         c->orig->orig = temp;
-         temp = NULL;
+         constraint temp = c->orig;
+         
+         /* avoid infinite loop */
+         c->orig = NULL;
+         c->orig = constraint_copy (c);
+         /*drl 03/2/2003 if c != NULL then the copy of c will != null*/
+         llassert (constraint_isDefined (c->orig) );
+         
+         if (c->orig->orig == NULL)
+           {
+             c->orig->orig = temp;
+             temp = NULL;
+           }
+         else
+           {
+             llcontbug ((message ("Expected c->orig->orig to be null")));
+             constraint_free (c->orig->orig);
+             c->orig->orig = temp;
+             temp = NULL;
+           }
        }
       else
        {
-         llcontbug ((message ("Expected c->orig->orig to be null")));
-         constraint_free (c->orig->orig);
-         c->orig->orig = temp;
-         temp = NULL;
+         DPRINTF (("Not changing constraint"));
        }
     }
-  else
-    {
-      DPRINTF (("Not changing constraint"));
-    }
-  
+
   DPRINTF ((message ("After Doing constraint_preserverOrig for %q ", constraint_unparseDetailed (c))));
   return c;
 }
index 74a97eea6f6087f5a3951b6defba485fc2aea8b6..e0ff371cea48520ac7d7b846f93b7bbf12b305d7 100644 (file)
@@ -60,7 +60,7 @@ static ctype constraintExpr_getCType (constraintExpr p_e);
 
 static /*@only@*/ constraintExpr constraintExpr_adjustMaxSetForCast (/*@only@*/ constraintExpr p_e,
                                                                     ctype p_tfrom, ctype p_tto,
-                                                                    fileloc loc);
+                                                                    fileloc p_loc);
 
 /*@special@*/ /*@notnull@*/ static constraintExpr constraintExpr_makeBinaryOp (void) 
      /* @allocates result->data @ @sets result->kind @ */ ;
@@ -438,7 +438,10 @@ constraintExpr constraintExpr_makeExprNode (exprNode e)
  exprNode t, t1, t2;
  lltok tok;
  
- llassert (e != NULL);
+ if (exprNode_isUndefined (e)) 
+   {
+     return constraintExpr_undefined;
+   }
  
  data = e->edata;
 
@@ -555,7 +558,7 @@ constraintExpr constraintExpr_makeExprNode (exprNode e)
      ret = constraintExpr_makeExprNode (t);
      break;
    case XPR_COMMA:
-     t = exprData_getPairA(data);
+     t = exprData_getPairA (data);
      ret = constraintExpr_makeExprNode(t);
      break;
    default:
@@ -2484,6 +2487,7 @@ static /*@only@*/ constraintExpr constraintExpr_div (/*@only@*/ constraintExpr e
       float fnewval;
       long newval;
 
+      llassert (e != NULL);
       llassert (e->kind == term);
       ct = constraintExprData_termGetTerm (e->data);
       llassert (constraintTerm_canGetValue (ct));
@@ -2491,18 +2495,19 @@ static /*@only@*/ constraintExpr constraintExpr_div (/*@only@*/ constraintExpr e
 
       DPRINTF (("Scaling constraints by: %ld * %f", val, scale));
 
-      // If scale * val is not an integer, give a warning
-      fnewval = val * scale;
+      fnewval = ((float) val) * scale;
       newval = (long) fnewval;
 
       DPRINTF (("Values: %f / %ld", fnewval, newval));
+
       if ((fnewval - (float) newval) > FLT_EPSILON) 
        {
          voptgenerror (FLG_ALLOCMISMATCH,
                        message ("Allocated memory is converted to type %s of (size %d), "
-                                "which is not divisible into original allocation of space for %d elements of type %s (size %d)",
+                                "which is not divisible into original allocation of space "
+                                "for %d elements of type %s (size %d)",
                                 ctype_unparse (tto), sizeto,
-                                val, ctype_unparse (tfrom), sizefrom),
+                                long_toInt (val), ctype_unparse (tfrom), sizefrom),
                        loc);
        }  
 
@@ -2544,71 +2549,80 @@ static /*@only@*/ constraintExpr constraintTerm_simpleDivTypeExprNode (/*@only@*
 
       if (lltok_isMult (tok))
        {
-         llassert (exprNode_isDefined(t1) && exprNode_isDefined(t2) );
+         /*
+         ** If the sizeof is first, flip them.
+         */
+
+         llassert (exprNode_isDefined(t1) && exprNode_isDefined(t2));
+
+         if (t2->kind == XPR_SIZEOF || t2->kind == XPR_SIZEOFT) 
+           {
+             exprNode tmp = t1;
+             t1 = t2;
+             t2 = tmp;
+           }
+         
          /*drl 3/2/2003 we know this from the fact that it's a
            multiplication operation...*/
          
-         if  ((t1->kind == XPR_SIZEOF) || (t1->kind == XPR_SIZEOFT))
+         if (t1->kind == XPR_SIZEOF || t1->kind == XPR_SIZEOFT)
            {
-             ctype ct2;
+             ctype multype;
              
              if (t1->kind == XPR_SIZEOFT)
                {
-                 ct2 = qtype_getType (exprData_getType (t1->edata));
+                 multype = qtype_getType (exprData_getType (t1->edata));
                }
              else
                {
                  exprNode tempE = exprData_getSingle (t1->edata);
-                 ct2 = exprNode_getType (tempE); 
+                 multype = exprNode_getType (tempE); 
                }
 
-             if (ctype_match (ctype_makePointer(ct2), tfrom)) //!
+             DPRINTF (("Here we go sizeof: %s / %s / %s",
+                       ctype_unparse (multype), ctype_unparse (tfrom), ctype_unparse (tto)));
+             llassert (ctype_isPointer (tfrom));
+
+             if (ctype_almostEqual (ctype_makePointer (multype), tto))
                {
                  /* this is a bit sloopy but ... */
-                 constraintExpr_free(e);
+                 constraintExpr_free (e);
+                 DPRINTF (("Sizeof types match okay!"));
                  return constraintExpr_makeExprNode (t2);
                }
              else
                {
-                 /* nothing was here */
-                 DPRINTF (("MISMATCHING TYPES!"));
-               }
-           }
-         else if ((t2->kind == XPR_SIZEOF) || (t2->kind == XPR_SIZEOFT))
-           {
-             ctype ct2;
-             
-             if (t2->kind == XPR_SIZEOFT)
-               {
-                 ct2 = qtype_getType (exprData_getType (t2->edata));
-               }
-             else
-               {
-                 exprNode exprTemp;
-                 exprData eDTemp;
-                 
-                 exprTemp = exprData_getSingle (t2->edata);
+                 int sizemul = ctype_getSize (multype);
+                 ctype tobase = ctype_baseArrayPtr (tto);
+                 int sizeto = ctype_getSize (tobase);
 
-                 llassert (exprNode_isDefined (exprTemp));
-                 eDTemp = exprTemp->edata;
-                 
-                 ct2 = qtype_getType (exprData_getType(eDTemp ));
-                 
-               }
+                 DPRINTF (("Types: %s / %s / %s",
+                           ctype_unparse (tfrom), ctype_unparse (tto), ctype_unparse (multype)));
 
-             if (ctype_match (ctype_makePointer (ct2), tfrom))
-               {
-                 /*a bit of a sloopy way to do this but... */
-                 constraintExpr_free(e);
-                 return constraintExpr_makeExprNode (t1);
+                 voptgenerror (FLG_ALLOCMISMATCH,
+                               message ("Allocated memory is used as a different type (%s) from the sizeof type (%s)",
+                                        ctype_unparse (tobase), ctype_unparse (multype)),
+                               loc);
+                 
+                 if (sizemul == sizeto) 
+                   {
+                     constraintExpr_free (e);
+                     DPRINTF (("Sizeof types match okay!"));
+                     return constraintExpr_makeExprNode (t2);
+                   }
+                 else
+                   {
+                     /* nothing was here */
+                     DPRINTF (("MISMATCHING TYPES!"));
+                     return (constraintExpr_div (constraintExpr_makeExprNode (t2), multype, tto, loc));
+                   }
                }
            }
          else
            {
              DPRINTF (("NOT A SIZEOF!"));
-             /*empty*/
+             /* empty */
            }
-         
        }
     }
 
index ec5427ba69a41f2ce7243f3d31bb0351882bf6a9..1ce4e370dc72c11b78c9e292512c35e0a96fa36c 100644 (file)
@@ -149,9 +149,7 @@ constraintExprData_termSetTerm (/*@returned@*/ constraintExprData data,
   return data;
 }
 
-
-
-/*@observer@*/ constraintTerm 
+/*@exposed@*/ constraintTerm 
 constraintExprData_termGetTerm (/*@observer@*/ constraintExprData data)
 {
   llassert (constraintExprData_isDefined (data));
index aa8657e3c1defb39f152b2549a39f2e9a8faabe8..3a94efd5c3ebae7670e188bdbdd388bd7993f55b 100644 (file)
@@ -53,7 +53,7 @@ static constraintList exprNode_traverseFalseEnsuresConstraints (/*@temp@*/ exprN
 
 static void checkArgumentList (/*@out@*/ exprNode p_temp, exprNodeList p_arglist, fileloc p_sequencePoint) /*@modifies p_temp @*/;
 
-static  constraintList checkCall (/*@temp@*/ exprNode p_fcn, exprNodeList p_arglist);
+static constraintList checkCall (/*@temp@*/ exprNode p_fcn, exprNodeList p_arglist);
 
 static bool exprNode_isUnhandled (/*@temp@*/ /*@observer@*/ exprNode e)
 {
@@ -155,7 +155,6 @@ static void exprNode_stmt (/*@temp@*/ exprNode e)
 {
   exprNode snode;
   fileloc loc;
-  //! cstring s;
   
   DPRINTF (("Generating constraint for: %s", exprNode_unparse (e)));
 
@@ -1337,7 +1336,7 @@ void exprNode_exprTraverse (/*@dependent@*/ exprNode e,
       
       fcn->requiresConstraints = 
        constraintList_addListFree (fcn->requiresConstraints,
-                                   checkCall (fcn, exprData_getArgs (data) ));      
+                                   checkCall (fcn, exprData_getArgs (data)));      
       
       fcn->ensuresConstraints = 
        constraintList_addListFree (fcn->ensuresConstraints,
@@ -2260,14 +2259,14 @@ constraintList checkCall (/*@dependent@*/ exprNode fcn, exprNodeList arglist)
        preconditions = constraintList_makeNew();
     }
   
-  if (context_getFlag (FLG_IMPLICTCONSTRAINT) )
+  if (context_getFlag (FLG_IMPBOUNDSCONSTRAINTS))
     {
 
       /*
       uentryList_elements (arglist, el)
        {
          sRef s;
-         TPRINTF((message("setImplictfcnConstraints doing: %s", uentry_unparse(el) ) ));
+         TPRINTF((message("setImplicitfcnConstraints doing: %s", uentry_unparse(el) ) ));
          
          s = uentry_getSref(el);
          if (sRef_isReference (s) )
index c834ec65f6d3e1a284a87a7b949093e309050bde..ea2712149651648ca9e2dda3ad76196610e3f1e5 100644 (file)
@@ -635,39 +635,6 @@ void constraintList_dump (/*@observer@*/ constraintList c,  FILE *f)
   end_constraintList_elements; ;
 }
 
-//! don't use this!
-void constraintList_castConstraints (constraintList c, ctype tfrom, ctype tto)
-{
-  if (TRUE) /* flag to allow casting */ 
-    {
-      int fsize = ctype_getSize (tfrom);
-      int tsize = ctype_getSize (tto);
-
-      DPRINTF (("Sizes: [%s] [%s] %d / %d", ctype_unparse (tfrom),
-               ctype_unparse (tto), fsize, tsize));
-
-      if (fsize == tsize) 
-       {
-         return; /* Sizes match, no change to constraints */
-       }
-      else 
-       {
-         float scale = fsize / tsize;
-         
-         DPRINTF (("Scaling constraints by: %f", scale));
-
-         constraintList_elements (c, el)
-           {
-             DPRINTF (("Scale: %s", constraint_unparse (el)));
-             // constraint_scaleSize (el, scale);
-             DPRINTF (("   ==> %s", constraint_unparse (el)));
-           }
-         end_constraintList_elements; 
-       }
-    }
-}
-
-
 constraintList constraintList_sort (/*@returned@*/ constraintList ret)
 {
   if (constraintList_isUndefined(ret) )
index 4896a3ac56de1f0a08c31a36bc200945b87afc50..10aa3c954aad392b18d272eb19efdfff3070956d 100644 (file)
@@ -632,9 +632,10 @@ static /*@only@*/ constraintList reflectChangesEnsuresFree1 (/*@only@*/ constrai
 
 static bool constraint_conflict (constraint c1, constraint c2)
 {
-
-  llassert(constraint_isDefined(c1) );
-  llassert(constraint_isDefined(c2) );
+  if (!constraint_isDefined(c1) || !constraint_isDefined(c2))
+    {
+      return FALSE;
+    }
 
   if (constraintExpr_similar (c1->lexpr, c2->lexpr))
     {
@@ -740,8 +741,15 @@ constraintList constraintList_fixConflicts (constraintList list1, constraintList
 
 static bool constraintResolve_satisfies (constraint pre, constraint post)
 {
-  llassert (constraint_isDefined(pre));
-  llassert (constraint_isDefined(post));
+  if (!constraint_isDefined (pre))
+    {
+      return TRUE;
+    }
+
+  if (!constraint_isDefined(post)) 
+    {
+      return FALSE;
+    }
 
   if (constraint_isAlwaysTrue (pre))
     return TRUE;
@@ -995,7 +1003,6 @@ bool constraint_isAlwaysTrue (/*@observer@*/ /*@temp@*/ constraint c)
     {
       switch (c->ar)
        {
-       case CASTEQ:
        case EQ:
        case GTE:
        case LTE:
@@ -1388,41 +1395,34 @@ static constraint  inequalitySubstituteUnsound  (/*@returned@*/ constraint c, co
 
 /*@only@*/ constraint constraint_substitute (/*@observer@*/ /*@temp@*/ constraint c, constraintList p)
 {
-  constraint ret;
+  constraint ret = constraint_copy (c);
 
-  ret = constraint_copy(c);
   constraintList_elements (p, el)
     {
-      llassert(constraint_isDefined(el) );
-       if ( el->ar == EQ)
-        if (!constraint_conflict (ret, el) )
-
-          {
-            constraint temp;
-            
-            temp = constraint_copy(el);
-            
-            temp = constraint_adjust(temp, ret);
-
-            llassert(constraint_isDefined(temp) );
-
-            
-            DPRINTF((message ("constraint_substitute :: Substituting in %s using %s",
-                              constraint_print (ret), constraint_print (temp)
-                              ) ) );
-                              
+      if (constraint_isDefined (el))
+       {
+         if ( el->ar == EQ)
+           if (!constraint_conflict (ret, el))
+             {
+               constraint temp = constraint_copy(el);
+               temp = constraint_adjust(temp, ret);
+               
+               llassert(constraint_isDefined(temp) );
+               
+               
+               DPRINTF (("constraint_substitute :: Substituting in %s using %s",
+                         constraint_print (ret), constraint_print (temp)));
          
-            ret = constraint_searchandreplace (ret, temp->lexpr, temp->expr);
-            DPRINTF(( message (" constraint_substitute :: The new constraint is %s", constraint_print (ret) ) ));
-            constraint_free(temp);
-          }
+               ret = constraint_searchandreplace (ret, temp->lexpr, temp->expr);
+               DPRINTF (("constraint_substitute :: The new constraint is %s", constraint_print (ret)));;
+               constraint_free(temp);
+             }
+       }
     }
   end_constraintList_elements;
 
-  ret = constraint_simplify(ret);
-
+  ret = constraint_simplify (ret);
   DPRINTF(( message (" constraint_substitute :: The final new constraint is %s", constraint_print (ret) ) ));
-
   return ret;
 }
 
index 60d51250e20405058a7c9b3ed556d3d248514594..ad99f1366081ff4bdeddab83f3d79786dac5ff0a 100644 (file)
@@ -4913,111 +4913,46 @@ valueTable context_createGlobalMarkerValueTable (stateInfo info)
     }
 }
 
-
-/*drl 12/30/01 these are some ugly functions that were added to facilitate struct annotations */
-
-
-/*drl added */
-static ctype lastStruct;
-
-ctype context_setLastStruct (/*@returned@*/ ctype s) /*@globals lastStruct@*/
+constraintList context_getImplicitFcnConstraints (uentry ue)
 {
-  lastStruct = s;
-  return s;
-}
-
-ctype context_getLastStruct (/*@returned@*/ /*ctype s*/) /*@globals lastStruct@*/
-{
-  return lastStruct;
-}
-
-/*
-** Why is this stuff in context.c?
-*/
-
-/*@unused@*/ static int sInfoNum = 0;
-
-
-struct getUe {
-  /*@unused@*/  uentry ue;
-  /*@unused@*/ sRef s;
-};
-
-struct sInfo {
-  /*@unused@*/ ctype ct;
-  /*@unused@*/ constraintList inv;
- /*@unused@*/ int ngetUe;
- /*@unused@*/ struct getUe * t ;
-};
-
-/* unused: static struct sInfo globalStructInfo; */
+  constraintList ret = constraintList_makeNew ();
+  uentryList params = uentry_getParams (ue);
 
-/*drl 1/6/2001: I didn't think these functions were solid enough to include in the
-  stable  release of splint.  I coomented them out so that they won't break anything
-  but didn't delete them because they will be fixed and included later
-
-
-*/
-
-/*@-paramuse@*/
-
-void context_setGlobalStructInfo (ctype ct, constraintList list)
-{
-# if 0
-  /* int i;
-  uentryList f;
-
-  f =  ctype_getFields (ct);
-  
-  if (constraintList_isDefined(list) )
+  uentryList_elements (params, el)
     {
-      globalStructInfo.ct = ct;
-      globalStructInfo.inv = list;
-
-      globalStructInfo.ngetUe = 0;
+      DPRINTF (("setImplicitfcnConstraints doing: %s", uentry_unparse(el)));
       
-      /* abstraction violation fix it * /
-      globalStructInfo.t   = dmalloc(f->nelements * sizeof(struct getUe) );
-
-      globalStructInfo.ngetUe = f->nelements;
-
-      i = 0;
-      
-      uentryList_elements(f, ue)
+      if (uentry_isElipsisMarker (el))
        {
-         globalStructInfo.t[i].ue = ue;
-         globalStructInfo.t[i].s = uentry_getSref(ue);
-         TPRINTF(( message(" setGlobalStructInfo:: adding ue=%s and sRef=%s",
-                           uentry_unparse(ue), sRef_unparse( uentry_getSref(ue) )
-                           )
-                   ));
-         i++;
+         ;
        }
-      end_uentryList_elements;
-    }
-  */
-# endif
-}
-
-# if 0
-/*
-
-bool hasInvariants (ctype ct) /*@* /
-{
-  if ( ctype_sameName(globalStructInfo.ct, ct) )
+      else
+       {
+         sRef s = uentry_getSref (el);
+         
+         DPRINTF (("Trying: %s", sRef_unparse (s)));
 
-    return TRUE;
+         if (ctype_isPointer (sRef_getType (s)))
+           {
+             constraint c = constraint_makeSRefWriteSafeInt (s, 0);
+             ret = constraintList_add (ret, c);
+             
+             /*drl 10/23/2002 added support for out*/
+             
+             if (!uentry_isOut(el))
+               {
+                 c = constraint_makeSRefReadSafeInt (s, 0);
+                 ret = constraintList_add (ret , c);
+               }
+           }
+         else
+           {
+             DPRINTF (("%s is NOT a pointer", sRef_unparseFull (s)));
+           }
+       }
+    } end_uentryList_elements;
 
-  else
-    
-    return FALSE;
-  
+  DPRINTF (("Returns ==> %s", constraintList_unparse (ret)));
+  return ret;
 }
-*/
-# endif
-
-/*@=paramuse@*/
-
-
-
 
index de8346e4daf2ba04b9f01d81b719a8453ad01fc4..c59eb7628313015a9b5de658abda9405dca3db3c 100644 (file)
@@ -2664,7 +2664,7 @@ int ctbase_getSize (ctbase ct)
            return ctype_getSize (ct->contents.base);
          }
       }
-    case CT_FIXEDARRAY: //!
+    case CT_FIXEDARRAY: 
     case CT_ARRAY:
     case CT_FCN:
     case CT_STRUCT:
index d3af6069b33f852a44dc1948df37c2763c07e3e8..8253a71322221fd2a311ca5efe8751eebc3a622d 100644 (file)
@@ -460,7 +460,8 @@ ctype_baseArrayPtr (ctype c)
 
       if (ctype_isBroken (clp))
        {
-         llbuglit ("ctype_baseArrayPtr: bogus ctype");
+         llcontbug (message ("ctype_baseArrayPtr: bogus ctype getting base of: %s", ctype_unparse (c)));
+         return ctype_unknown;
        }
 
       return clp;
index db425a74ee90a3adf388a879c65e55eb6ddc3ffd..219387b99885217982adfa0e8a15c18611474f43 100644 (file)
@@ -942,11 +942,12 @@ void exprNode_checkFunction (/*@unused@*/ uentry ue, /*@only@*/ exprNode body)
 {
   constraintList c, t, post;
   constraintList c2, fix;
-  constraintList implicitFcnConstraints;
   context_enterInnerContext ();
 
   llassert (exprNode_isDefined (body));
 
+  DPRINTF (("Checking body: %s", exprNode_unparse (body)));
+
   /*
     if we're not going to be printing any errors for buffer overflows
     we can skip the checking to improve performance
@@ -955,21 +956,18 @@ void exprNode_checkFunction (/*@unused@*/ uentry ue, /*@only@*/ exprNode body)
     in order to find potential problems like assert failures and seg faults...
   */
 
-  if (!context_getFlag(FLG_DEBUGFUNCTIONCONSTRAINT))
-    {
-      /* check if errors will printed */
-      if (!(context_getFlag(FLG_DEBUGFUNCTIONCONSTRAINT) ||
-           context_getFlag(FLG_BOUNDSWRITE) ||
-           context_getFlag(FLG_BOUNDSREAD)  ||
-           context_getFlag(FLG_LIKELYBOUNDSWRITE) ||
-           context_getFlag(FLG_LIKELYBOUNDSREAD)  ||
-           context_getFlag(FLG_CHECKPOST) ))
-       {
-         exprNode_free (body);
-         context_exitInnerPlain();       
-         return;
-       }
-    }
+  if (!(context_getFlag (FLG_DEBUGFUNCTIONCONSTRAINT) 
+       || context_getFlag (FLG_BOUNDSWRITE) 
+       || context_getFlag (FLG_BOUNDSREAD)  
+       || context_getFlag (FLG_LIKELYBOUNDSWRITE) 
+       || context_getFlag (FLG_LIKELYBOUNDSREAD)  
+       || context_getFlag (FLG_CHECKPOST)
+       || context_getFlag (FLG_ALLOCMISMATCH)))
+  {
+    exprNode_free (body);
+    context_exitInnerPlain();    
+    return;
+  }
   
   exprNode_generateConstraints (body); /* evans 2002-03-02: this should not be declared to take a
                                          dependent... fix it! */
@@ -978,8 +976,7 @@ void exprNode_checkFunction (/*@unused@*/ uentry ue, /*@only@*/ exprNode body)
   
   if (constraintList_isDefined (c))
     {
-      DPRINTF ((message ("Function preconditions are %s \n\n\n\n\n", 
-                        constraintList_unparseDetailed (c) ) ) );
+      DPRINTF (("Function preconditions are %s", constraintList_unparseDetailed (c)));
       
       body->requiresConstraints = 
        constraintList_reflectChangesFreePre (body->requiresConstraints, c);
@@ -1023,14 +1020,21 @@ void exprNode_checkFunction (/*@unused@*/ uentry ue, /*@only@*/ exprNode body)
       DPRINTF((message ("The Function %s has no preconditions", uentry_unparse(ue))));
     }
   
-  implicitFcnConstraints = getImplicitFcnConstraints();
-  
-  if (constraintList_isDefined(implicitFcnConstraints) )
+  if (context_getFlag (FLG_IMPBOUNDSCONSTRAINTS))
     {
-      if (context_getFlag (FLG_IMPLICTCONSTRAINT) )
+      constraintList implicitFcnConstraints = context_getImplicitFcnConstraints (ue);
+      
+      if (constraintList_isDefined (implicitFcnConstraints))
        {
+         DPRINTF (("Implicit constraints: %s", constraintList_unparse (implicitFcnConstraints)));
+         
          body->requiresConstraints = constraintList_reflectChangesFreePre (body->requiresConstraints, 
-                                                                           implicitFcnConstraints );
+                                                                           implicitFcnConstraints);
+         constraintList_free (implicitFcnConstraints);
+       }
+      else
+       {
+         DPRINTF (("No implicit constraints"));
        }
     }
   
@@ -1093,7 +1097,7 @@ void exprNode_checkFunction (/*@unused@*/ uentry ue, /*@only@*/ exprNode body)
        printf ("The ensures constraints are:\n%s", constraintList_unparseDetailed(body->ensuresConstraints) );
    */
    
-   if (constraintList_isDefined(c) )
+   if (constraintList_isDefined (c))
      constraintList_free(c);
 
    context_exitInnerPlain();
index 15eb9c33b09e5ba43dddd962350b53110257637f..62b44f8b35e815adfa9f26800c499059d84eaf8b 100644 (file)
@@ -5012,9 +5012,6 @@ exprNode_cast (/*@only@*/ lltok tok, /*@only@*/ exprNode e, /*@only@*/ qtype q)
 
   DPRINTF (("Cast: -> %s", sRef_unparseFull (ret->sref)));
 
-  constraintList_castConstraints (ret->requiresConstraints, t, c);
-  constraintList_castConstraints (ret->ensuresConstraints, t, c);
-  
   if (!sRef_isConst (e->sref))
     {
       usymtab_addForceMustAlias (ret->sref, e->sref);
index 248f91fb805ad4d280e104224408522dd427e77d..fbce747f257fb0273568ed21ead25688471073fa 100644 (file)
@@ -1981,7 +1981,7 @@ static flaglist flags =
   {
     FK_BOUNDS, FK_MEMORY, plainFlag,
     "impboundsconstraints",
-    FLG_IMPLICTCONSTRAINT,
+    FLG_IMPBOUNDSCONSTRAINTS,
     "generate implicit constraints for functions",
     NULL,
     0, 0
index a78acf37de1cac264055a9b3c688227a14d99f33..cb1a43222212d7424a9b2262d444bce4f6f78531 100644 (file)
@@ -173,17 +173,16 @@ functionClauseList_free (functionClauseList s)
 }
 
 functionClauseList 
-functionClauseList_setImplictConstraints (/*@returned@*/ functionClauseList s)
+functionClauseList_setImplicitConstraints (/*@returned@*/ functionClauseList s)
 {
   bool addedConstraints;
 
   constraintList c;
   
-  DPRINTF ((message ("functionClauseList_setImplictConstraints called ") ));
+  DPRINTF ((message ("functionClauseList_setImplicitConstraints called ") ));
   
   addedConstraints = FALSE;
 
-
   c = getImplicitFcnConstraints ();
   
   if (constraintList_isEmpty(c) )
@@ -203,14 +202,14 @@ functionClauseList_setImplictConstraints (/*@returned@*/ functionClauseList s)
                {
                  constraintList implCons = getImplicitFcnConstraints ();
                  
-                 DPRINTF ((message ("functionClauseList_ImplictConstraints adding the implict constraints: %s to %s",
+                 DPRINTF ((message ("functionClauseList_ImplicitConstraints adding the implict constraints: %s to %s",
                                     constraintList_print(implCons), constraintList_print (con->constraint.buffer))));
                  
                  functionConstraint_addBufferConstraints (con, constraintList_copy (implCons) );
 
                  addedConstraints = TRUE;
                  
-                 DPRINTF ((message ("functionClauseList_ImplictConstraints the new constraint is %s",
+                 DPRINTF ((message ("functionClauseList_ImplicitConstraints the new constraint is %s",
                                     functionConstraint_unparse (con))));
 
                }
index a35ff69b81b054e6d5cec485224dd28c366a62cd..1d9243f663c10755f310c943b4b4d98bd36d8408 100644 (file)
@@ -9489,8 +9489,7 @@ uentry_mergeEntries (uentry spec, /*@only@*/ uentry def)
       llassert (uentry_isFunction (spec));
     }
   
-  DPRINTF (("Merge entries: %s / %s",
-           uentry_unparseFull (spec),
+  DPRINTF (("Merge entries: %s / %s", uentry_unparseFull (spec),
            uentry_unparseFull (def)));
 
   uentry_mergeConstraints (spec, def);
index 07acfc98fccf68fc50de2b82a7bf2ebf5fddcab7..5c25a8cfe1e0a14d9d0af5ee4952e5a10c618d08 100644 (file)
@@ -46,7 +46,7 @@ UNITTESTS = \
   decl divzero enum enumtag exports external fields flags forbody format freearray \
   funcpointer functionmacro glob globals impabstract info init inparam internal iter keep libs \
   linked lintcomments list longint loopexec looptesteffect \
-  macros macrosef merge mergenull modifies modtest moduncon \
+  macros macrosef malloc merge mergenull modifies modtest moduncon \
   mongoincludes mystrncat noeffect null nullret nullassign numabstract observer oldstyle outglob outparam \
   parentype postnotnull preds prefixes printflike rc refcounts release repexpose \
   returned russian sharing shifts sizesigns slovaknames \
@@ -300,12 +300,16 @@ controldepth:
        -$(SPLINTR) +hints -controlnestdepth 2 controldepth.c -expect 2
        -$(SPLINTR) +hints -controlnestdepth 1 controldepth.c -expect 2
 
+###
+### 1 extra warning reported for +strict now because of out-of-bounds read
+###
+
 .PHONY: compdestroy
 compdestroy:
        -$(SPLINTRN) compdestroy.c +checks -exportlocal -exportheader -expect 1
        -$(SPLINTRN) compdestroy.c +checks -exportlocal -exportheader +strictdestroy -expect 2
        -$(SPLINTRN) compdestroy.c +checks -exportlocal -exportheader +strictdestroy +strictusereleased -expect 3
-       -$(SPLINTRN) compdestroy.c +strict +partial -exportheader -expect 3
+       -$(SPLINTRN) compdestroy.c +strict +partial -exportheader -expect 4
 
 .PHONY: compoundliterals
 compoundliterals:
@@ -368,7 +372,7 @@ deadparam:
 .PHONY: decl
 decl:
        -$(SPLINTR) decl.c -expect 2
-       -$(SPLINTRN) decl.c +strict -exportlocal -expect 5
+       -$(SPLINTRN) decl.c +strict -exportlocal -expect 6
        -$(SPLINTR) decl2 -expect 4
 
 .PHONY: divzero
@@ -555,6 +559,10 @@ macrosef:
        -$(SPLINTR) macrosef.c +allmacros -expect 3
        -$(SPLINTR) macrosef.c +allmacros +sefuncon -expect 4
 
+.PHONY: malloc
+malloc:
+       -$(SPLINTRN) malloc.c +bounds -exportlocal -expect 7
+
 .PHONY: merge
 merge:
        -$(SPLINTRN) merge.c +checks -exportlocal -exportheadervar -exportheader -expect 3
@@ -576,7 +584,7 @@ modtest:
 .PHONY: moduncon
 moduncon:
        -$(SPLINTR) moduncon.c +moduncon -memchecks -expect 4
-       -$(SPLINTRN) moduncon.c +strict -exportlocal -expect 22
+       -$(SPLINTRN) moduncon.c +strict +impboundsconstraints -exportlocal -expect 22 
 
 .PHONY: mongoincludes
 mongoincludes:
@@ -675,7 +683,7 @@ parentype:
 preds:
        -$(SPLINTR) +hints preds.c -expect 6
        -$(SPLINTRN) +hints preds.c -weak -expect 1
-       -$(SPLINTRN) +hints preds.c -strict -exportlocal -exportheader -expect 10
+       -$(SPLINTRN) +hints preds.c -strict +impboundsconstraints -exportlocal -exportheader -expect 10
 
 .PHONY: prefixes
 prefixes:
@@ -1136,6 +1144,7 @@ EXTRA_DIST =  ./abst_t.lcl \
               ./longconstants.c \
               ./macros.c \
               ./macrosef.c \
+             ./malloc.c \
               ./merge.c \
               ./modclient.c \
               ./modifies.c \
index ab267a78318ca735fa370802d3c15dd205d403b0..f06bd5326e8c51e087c100be50b7769c017b64dc 100644 (file)
@@ -134,7 +134,7 @@ UNITTESTS = \
   decl divzero enum enumtag exports external fields flags forbody format freearray \
   funcpointer functionmacro glob globals impabstract info init inparam internal iter keep libs \
   linked lintcomments list longint loopexec looptesteffect \
-  macros macrosef merge mergenull modifies modtest moduncon \
+  macros macrosef malloc merge mergenull modifies modtest moduncon \
   mongoincludes mystrncat noeffect null nullret nullassign numabstract observer oldstyle outglob outparam \
   parentype postnotnull preds prefixes printflike rc refcounts release repexpose \
   returned russian sharing shifts sizesigns slovaknames \
@@ -356,6 +356,7 @@ EXTRA_DIST = ./abst_t.lcl \
               ./longconstants.c \
               ./macros.c \
               ./macrosef.c \
+             ./malloc.c \
               ./merge.c \
               ./modclient.c \
               ./modifies.c \
@@ -1106,12 +1107,16 @@ controldepth:
        -$(SPLINTR) +hints -controlnestdepth 2 controldepth.c -expect 2
        -$(SPLINTR) +hints -controlnestdepth 1 controldepth.c -expect 2
 
+###
+### 1 extra warning reported for +strict now because of out-of-bounds read
+###
+
 .PHONY: compdestroy
 compdestroy:
        -$(SPLINTRN) compdestroy.c +checks -exportlocal -exportheader -expect 1
        -$(SPLINTRN) compdestroy.c +checks -exportlocal -exportheader +strictdestroy -expect 2
        -$(SPLINTRN) compdestroy.c +checks -exportlocal -exportheader +strictdestroy +strictusereleased -expect 3
-       -$(SPLINTRN) compdestroy.c +strict +partial -exportheader -expect 3
+       -$(SPLINTRN) compdestroy.c +strict +partial -exportheader -expect 4
 
 .PHONY: compoundliterals
 compoundliterals:
@@ -1174,7 +1179,7 @@ deadparam:
 .PHONY: decl
 decl:
        -$(SPLINTR) decl.c -expect 2
-       -$(SPLINTRN) decl.c +strict -exportlocal -expect 5
+       -$(SPLINTRN) decl.c +strict -exportlocal -expect 6
        -$(SPLINTR) decl2 -expect 4
 
 .PHONY: divzero
@@ -1359,6 +1364,10 @@ macrosef:
        -$(SPLINTR) macrosef.c +allmacros -expect 3
        -$(SPLINTR) macrosef.c +allmacros +sefuncon -expect 4
 
+.PHONY: malloc
+malloc:
+       -$(SPLINTRN) malloc.c +bounds -exportlocal -expect 7
+
 .PHONY: merge
 merge:
        -$(SPLINTRN) merge.c +checks -exportlocal -exportheadervar -exportheader -expect 3
@@ -1380,7 +1389,7 @@ modtest:
 .PHONY: moduncon
 moduncon:
        -$(SPLINTR) moduncon.c +moduncon -memchecks -expect 4
-       -$(SPLINTRN) moduncon.c +strict -exportlocal -expect 22
+       -$(SPLINTRN) moduncon.c +strict +impboundsconstraints -exportlocal -expect 22 
 
 .PHONY: mongoincludes
 mongoincludes:
@@ -1478,7 +1487,7 @@ parentype:
 preds:
        -$(SPLINTR) +hints preds.c -expect 6
        -$(SPLINTRN) +hints preds.c -weak -expect 1
-       -$(SPLINTRN) +hints preds.c -strict -exportlocal -exportheader -expect 10
+       -$(SPLINTRN) +hints preds.c -strict +impboundsconstraints -exportlocal -exportheader -expect 10
 
 .PHONY: prefixes
 prefixes:
index 9e05b62a266cf7c2e4f8f066974a49f283878f38..6f344765534519aa8e31fda6da24c75337e7c1d8 100644 (file)
@@ -32,8 +32,13 @@ compdestroy.c:16:13: Possibly dead storage x->ips[] passed as out parameter:
    compdestroy.c:15:13: Storage x->ips[] possibly released
 compdestroy.c:19:9: Only storage x->ips[] (type oip) derived from released
                        storage may not have been released: x->ips
+compdestroy.c:15:13: Possible out-of-bounds read: x->ips[i]
+    Unable to resolve constraint:
+    requires maxRead(x->ips @ compdestroy.c:15:13) >= i @ compdestroy.c:15:20
+     needed to satisfy precondition:
+    requires maxRead(x->ips @ compdestroy.c:15:13) >= i @ compdestroy.c:15:20
 compdestroy.c: (in function sip_free2)
 compdestroy.c:25:9: Only storage *(x->ips) (type oip) derived from released
                        storage is not released (memory leak): x->ips
 
-Finished checking --- 3 code warnings, as expected
+Finished checking --- 4 code warnings, as expected
index 467493b7469c9c0fe56b3876208c8106aced27d6..c0c2071df2135bf6c9c94f0e2d278fe4024e44ae 100644 (file)
@@ -1,14 +1,12 @@
 
 constannot.c: (in function foo2)
-constannot.c:11:3: Possible out-of-bounds store:
-    str[20]
+constannot.c:11:3: Possible out-of-bounds store: str[20]
     Unable to resolve constraint:
     requires maxSet(str @ constannot.c:11:3) >= 20
      needed to satisfy precondition:
     requires maxSet(str @ constannot.c:11:3) >= 20
 constannot.c: (in function foo3)
-constannot.c:20:3: Likely out-of-bounds store:
-    foo(buf)
+constannot.c:20:3: Likely out-of-bounds store: foo(buf)
     Unable to resolve constraint:
     requires <const int=20> <= 19
      needed to satisfy precondition:
index cf21fbbf62ed4ec4ce57e12ecae29eb935ff2079..2dcbe24fcffe514e9bd4b94ca9ba7cdf40e42d7f 100644 (file)
@@ -9,10 +9,16 @@ decl.c:3:5: Function main declared without parameter list
 decl.c: (in function main)
 decl.c:7:3: Call to non-function (type [function (int) returns int] **): x
 decl.c:8:2: Path with no return in function declared to return int
+decl.c: (in function foo1)
+decl.c:13:3: Likely out-of-bounds store: buf[10]
+    Unable to resolve constraint:
+    requires 9 >= 10
+     needed to satisfy precondition:
+    requires maxSet(buf @ decl.c:13:3) >= 10
 decl.c:1:5: Function test declared but not defined
 decl.c:1:5: Function test exported but not declared in header file
 
-Finished checking --- 5 code warnings, as expected
+Finished checking --- 6 code warnings, as expected
 
 decl2.c:3:6: Variable glob2 defined with inconsistent type (arrays and pointers
                 are not identical in variable declarations): int *
index e75990d2de3f28b254fbf0c67db3df51efa56171..e1054c930a01625f5ea5771f78495089d90a3e89 100644 (file)
@@ -1,7 +1,6 @@
 
 for.c: (in function f)
-for.c:13:5: Possible out-of-bounds store:
-    t[i]
+for.c:13:5: Possible out-of-bounds store: t[i]
     Unable to resolve constraint:
     requires i @ for.c:13:7 <= 10
      needed to satisfy precondition:
diff --git a/test/malloc.c b/test/malloc.c
new file mode 100644 (file)
index 0000000..01f1458
--- /dev/null
@@ -0,0 +1,38 @@
+void f1 ()
+{
+  int *ip = (int *) malloc (89); /* not divisible */
+  if (ip != NULL) {
+    ip[88]=23; /* out of range */
+    free (ip);
+  }
+}
+
+void f2 ()
+{
+  int *ip = (int *) malloc (88); /* divisible okay */
+  if (ip != NULL) {
+    ip[21]=23; /* okay */
+    ip[22]=23; /* bad */
+    free (ip);
+  }
+}
+
+void f3 ()
+{
+  int *ip = (int *) malloc (87 * sizeof (int)); 
+  if (ip != NULL) {
+    ip[21]=23; /* okay */
+    ip[86]=23; /* okay */
+    ip[87]=23; /* bad */
+    free (ip);
+  }
+}
+
+void f4 ()
+{
+  int *ip = (int *) malloc (87 * sizeof (short)); /* not divisible */
+  if (ip != NULL) {
+    ip[86]=23; /* bad */
+    free (ip);
+  }
+}
diff --git a/test/malloc.expect b/test/malloc.expect
new file mode 100644 (file)
index 0000000..2bc1196
--- /dev/null
@@ -0,0 +1,35 @@
+
+malloc.c: (in function f1)
+malloc.c:3:21: Allocated memory is converted to type int * of (size 32), which
+    is not divisible into original allocation of space for 89 elements of type
+    void * (size 8)
+malloc.c:5:5: Likely out-of-bounds store: ip[88]
+    Unable to resolve constraint:
+    requires 21 >= 88
+     needed to satisfy precondition:
+    requires maxSet(ip @ malloc.c:5:5) >= 88
+malloc.c: (in function f2)
+malloc.c:15:5: Likely out-of-bounds store: ip[22]
+    Unable to resolve constraint:
+    requires 21 >= 22
+     needed to satisfy precondition:
+    requires maxSet(ip @ malloc.c:15:5) >= 22
+malloc.c: (in function f3)
+malloc.c:26:5: Likely out-of-bounds store: ip[87]
+    Unable to resolve constraint:
+    requires 86 >= 87
+     needed to satisfy precondition:
+    requires maxSet(ip @ malloc.c:26:5) >= 87
+malloc.c: (in function f4)
+malloc.c:33:21: Allocated memory is used as a different type (int) from the
+                   sizeof type (short int)
+malloc.c:33:21: Allocated memory is converted to type int * of (size 32), which
+    is not divisible into original allocation of space for 87 elements of type
+    short int (size 8)
+malloc.c:35:5: Likely out-of-bounds store: ip[86]
+    Unable to resolve constraint:
+    requires 20 >= 86
+     needed to satisfy precondition:
+    requires maxSet(ip @ malloc.c:35:5) >= 86
+
+Finished checking --- 7 code warnings, as expected
index e975c0069d5a0c0efae21a8874666cf465665db8..e1b399508ce3e52841f113554611746323704569 100644 (file)
@@ -202,8 +202,7 @@ ignore.c:10: Return value (type bool) ignored: fb()
 
 Finished checking --- 1 code warning, as expected
 
-setChar.c:5: Likely out-of-bounds store:
-    buf[10]
+setChar.c:5: Likely out-of-bounds store: buf[10]
     Unable to resolve constraint:
     requires 9 >= 10
      needed to satisfy precondition:
@@ -211,8 +210,7 @@ setChar.c:5: Likely out-of-bounds store:
 
 Finished checking --- 1 code warning, as expected
 
-multiError.c:4: Possible out-of-bounds store:
-    buf[2]
+multiError.c:4: Possible out-of-bounds store: buf[2]
     Unable to resolve constraint:
     requires maxSet(buf @ multiError.c:4) >= 2
      needed to satisfy precondition:
index 6a34ab0d7a6eab3950ca2cde0269387e4fb0f5ec..306c5d1525477d4a2dc1ffabc5e4f3876b7a2c79 100644 (file)
@@ -2,8 +2,7 @@
 Finished checking --- no warnings
 
 maxsetnoannotations.c: (in function noancopy)
-maxsetnoannotations.c:2:3: Possible out-of-bounds store:
-    strcpy(a, b)
+maxsetnoannotations.c:2:3: Possible out-of-bounds store: strcpy(a, b)
     Unable to resolve constraint:
     requires maxSet(a @ maxsetnoannotations.c:2:11) >= maxRead(b @
     maxsetnoannotations.c:2:13)
index 4ac254252371e02207a2468220107391635cd7e5..64e5ccf5028ebe4c4c6b43031f5b491f38094477 100644 (file)
@@ -3,28 +3,24 @@ unrecogCall.c: (in function foo)
 unrecogCall.c:8:3: Unrecognized identifier: bar
 initialization.c: (in function initialization)
 initialization.c:5:10: Variable g declared but not used
-initialization.c:5:14: Possible out-of-bounds read:
-    e[22]
+initialization.c:5:14: Possible out-of-bounds read: e[22]
     Unable to resolve constraint:
     requires maxRead(d @ initialization.c:3:14) >= 22
      needed to satisfy precondition:
     requires maxRead(e @ initialization.c:5:14) >= 22
-initialization.c:8:3: Possible out-of-bounds store:
-    f[2]
+initialization.c:8:3: Possible out-of-bounds store: f[2]
     Unable to resolve constraint:
     requires maxSet(d @ initialization.c:3:14) >= 2
      needed to satisfy precondition:
     requires maxSet(f @ initialization.c:8:3) >= 2
 simplifyTest.c: (in function fooSub)
-simplifyTest.c:3:3: Possible out-of-bounds store:
-    s[i]
+simplifyTest.c:3:3: Possible out-of-bounds store: s[i]
     Unable to resolve constraint:
     requires maxSet(s @ simplifyTest.c:3:3) >= i @ simplifyTest.c:3:5
      needed to satisfy precondition:
     requires maxSet(s @ simplifyTest.c:3:3) >= i @ simplifyTest.c:3:5
 simplifyTest.c: (in function fooAdd)
-simplifyTest.c:10:3: Possible out-of-bounds store:
-    s[i + 2]
+simplifyTest.c:10:3: Possible out-of-bounds store: s[i + 2]
     Unable to resolve constraint:
     requires maxSet(s @ simplifyTest.c:10:3) >= i @ simplifyTest.c:10:5 + 2
      needed to satisfy precondition:
index 1119c82593e60030a410ac2191d94fdc3e98f4c6..f46f3b91f9ace814dacc05d5ac0d335315aa58c5 100644 (file)
@@ -1,7 +1,6 @@
 
 unknownsize.c: (in function uknSize1)
-unknownsize.c:9:3: Possible out-of-bounds store:
-    c[9]
+unknownsize.c:9:3: Possible out-of-bounds store: c[9]
     Unable to resolve constraint:
     requires maxSet(c @ unknownsize.c:9:3) >= 9
      needed to satisfy precondition:
@@ -10,8 +9,7 @@ unknownsize.c:9:3: Possible out-of-bounds store:
 Finished checking --- 1 code warning, as expected
 
 fixedArrayType.c: (in function fixedArrayTouch)
-fixedArrayType.c:9:3: Possible out-of-bounds store:
-    buffer[sizeof(Array) - 1]
+fixedArrayType.c:9:3: Possible out-of-bounds store: buffer[sizeof(Array) - 1]
     Unable to resolve constraint:
     requires sizeof(Array) @ fixedArrayType.c:9:25 <= 10
      needed to satisfy precondition:
index 3db1c55e0eb5102e18e9a3d1951ab333952e23b6..c8d41a14b6d300c85f5ed97353b5ed1b83c8df83 100644 (file)
@@ -3,8 +3,7 @@ m.c: (in function t)
 m.c:9:1: Index of possibly null pointer f: f
    m.c:8:5: Storage f may become null
 sizeof.c: (in function f)
-sizeof.c:17:1: Likely out-of-bounds store:
-    x[(sizeof(x))]
+sizeof.c:17:1: Likely out-of-bounds store: x[(sizeof(x))]
     Unable to resolve constraint:
     requires 2 >= 3
      needed to satisfy precondition:
@@ -12,8 +11,7 @@ sizeof.c:17:1: Likely out-of-bounds store:
 test3.c:2:6: Function t defined more than once
    m.c:11:1: Previous definition of t
 test3.c: (in function t)
-test3.c:9:3: Likely out-of-bounds store:
-    g[101]
+test3.c:9:3: Likely out-of-bounds store: g[101]
     Unable to resolve constraint:
     requires 99 >= 101
      needed to satisfy precondition:
@@ -21,14 +19,12 @@ test3.c:9:3: Likely out-of-bounds store:
 test7.c:2:6: Function t defined more than once
    m.c:11:1: Previous definition of t
 test7.c: (in function t)
-test7.c:6:3: Possible out-of-bounds store:
-    g[2]
+test7.c:6:3: Possible out-of-bounds store: g[2]
     Unable to resolve constraint:
     requires maxSet(g @ test7.c:4:3) >= 4
      needed to satisfy precondition:
     requires maxSet(g @ test7.c:6:3) >= 2
-test7.c:8:3: Possible out-of-bounds store:
-    j[0]
+test7.c:8:3: Possible out-of-bounds store: j[0]
     Unable to resolve constraint:
     requires maxSet(j @ test7.c:8:3) >= 0
      needed to satisfy precondition:
index 8bbef3c0ceca077f97994a1d451d9c0c97774ece..5d6a0e9ad920005bbd4f29da9ef44572e375b418 100644 (file)
@@ -1,7 +1,6 @@
 
 sizeof.c: (in function main)
-sizeof.c:6:2: Likely out-of-bounds store:
-    x[(sizeof(x))]
+sizeof.c:6:2: Likely out-of-bounds store: x[(sizeof(x))]
     Unable to resolve constraint:
     requires 2 >= 3
      needed to satisfy precondition:
This page took 0.176539 seconds and 5 git commands to generate.