]> andersk Git - splint.git/blobdiff - src/uentry.c
Fixed branch state bug with definitely null values (reported by Jon Wilson).
[splint.git] / src / uentry.c
index 5d593b2b715432f0d69407350a85072d0b633dae..7bba3f167e3ba664b42c209962a0d7a3f2e33115 100644 (file)
@@ -1,5 +1,5 @@
 /*
-** LCLint - annotation-assisted static program checker
+** Splint - annotation-assisted static program checker
 ** Copyright (C) 1994-2001 University of Virginia,
 **         Massachusetts Institute of Technology
 **
@@ -19,7 +19,7 @@
 **
 ** For information on lclint: lclint-request@cs.virginia.edu
 ** To report a bug: lclint-bug@cs.virginia.edu
-** For more information: http://lclint.cs.virginia.edu
+** For more information: http://www.splint.org
 */
 /*
 ** uentry.c
@@ -90,6 +90,16 @@ static /*@only@*/ /*@notnull@*/ uentry
   uentry_makeVariableAux (cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f,
                          /*@exposed@*/ sRef p_s, bool p_priv, vkind p_kind);
 
+static void uentry_convertVarFunction (uentry ue) /*@modifies ue@*/
+{
+  if (uentry_isVariable (ue) 
+      && (ctype_isFunction (ctype_realType (uentry_getType (ue)))
+         || ctype_isUnknown (uentry_getType (ue))))
+    {
+      uentry_makeVarFunction (ue);
+    }
+}
+
 static /*@out@*/ /*@notnull@*/ uentry uentry_alloc (void) /*@*/ 
 {
   uentry ue = (uentry) dmalloc (sizeof (*ue));
@@ -101,11 +111,13 @@ static /*@out@*/ /*@notnull@*/ uentry uentry_alloc (void) /*@*/
 }
 
 static cstring uentry_getOptName (uentry p_e) /*@*/ ;
-static void uentry_copyInto (/*@out@*/ /*@unique@*/ uentry p_unew, uentry p_old);
+static void uentry_updateInto (/*@unique@*/ uentry p_unew, uentry p_old) /*@modifies p_unew, p_old@*/ ;
+
 static void uentry_setNullState (/*@notnull@*/ uentry p_ue, nstate p_ns);
 static void uentry_setAliasKind (/*@notnull@*/ uentry p_ue, alkind p_ak);
 static /*@only@*/ /*@null@*/ uinfo uinfo_copy (uinfo p_u, ekind p_kind);
 static void uinfo_free (/*@only@*/ uinfo p_u, ekind p_kind);
+static void ucinfo_free (/*@only@*/ ucinfo p_u);
 static void uvinfo_free (/*@only@*/ uvinfo p_u);
 
 # ifdef DOANNOTS
@@ -552,110 +564,71 @@ static /*@observer@*/ cstring uentry_reDefDecl (uentry old, uentry unew)  /*@*/
     }
 }
 
-
-/*drl7x*/
-/*@only@*/ constraintList uentry_getFcnPreconditions (uentry ue)
+static constraintList uentry_getFunctionConditions (uentry ue, bool isPost)
 {
   if (uentry_isValid (ue))
     {
-      {
-       if (uentry_isVariable (ue) && ctype_isFunction (uentry_getType (ue)))
-         {
-           DPRINTF(( (message( "Function pointer %s not doing  uentry_getFcnPreconditions", uentry_unparse(ue) )) ));
-           //  uentry_makeVarFunction (ue);
-         }
-       
-       //llassert (uentry_isFunction (ue));
-       //llassert ((ue->info->fcn->preconditions));
-       //llassert ((ue->info->fcn->preconditions));
-
-       if (!uentry_isFunction (ue))
-         {
-           DPRINTF( (message ("called uentry_getFcnPreconditions on nonfunction %s",
-                              uentry_unparse (ue) ) ) );
-           if (!uentry_isSpecified (ue) )
-             {
-               DPRINTF((message ("called uentry_getFcnPreconditions on nonfunction %s",
-                                 uentry_unparse (ue) ) ));
-               return constraintList_undefined;
-             }
-           
-           
-           return constraintList_undefined;
-         }
-       
-       if (functionConstraint_hasBufferConstraint (ue->info->fcn->preconditions))
-         {
-           return constraintList_copy (functionConstraint_getBufferConstraint (ue->info->fcn->preconditions));
-         }
-       else
-         {
-           return NULL;
-         }
-      }
-    }
-  
-  return constraintList_undefined;
-}
+      functionConstraint constraint;
 
-
-
-
-/*drl
-  12/28/2000
-*/
-constraintList uentry_getFcnPostconditions (uentry ue)
-{
-  if (uentry_isValid (ue))
-    {
       DPRINTF( (message ("called uentry_getFcnPostconditions on  %s",
-                                 uentry_unparse (ue) ) ) );
+                        uentry_unparse (ue) ) ) );
+      
+      if (uentry_isVariable (ue) && ctype_isFunction (uentry_getType (ue)))
        {
-         if (uentry_isVariable (ue) && ctype_isFunction (uentry_getType (ue)))
+         DPRINTF( (message ("called uentry_getFunctionConditions on nonfunction %s",
+                            uentry_unparse (ue) ) ) );
+         if (!uentry_isFunction (ue) )
            {
-             DPRINTF( (message ("called uentry_getFcnPostconditions on nonfunction %s",
-                                 uentry_unparse (ue) ) ) );
-             if (!uentry_isFunction (ue) )
-               {
-                 DPRINTF((message ("called uentry_getFcnPostconditions on nonfunction %s",
-                                       uentry_unparse (ue) ) ));
-                     return constraintList_undefined;
-                   }
-         
-
-                 return constraintList_undefined;
-           }
-
-         //  llassert (uentry_isFunction (ue));
-         if (!uentry_isFunction(ue) )
-           {
-             
-             DPRINTF( (message ("called uentry_getFcnPostconditions on non function  %s",
-                                 uentry_unparse (ue) ) ) );
-               return constraintList_undefined;
-
+             DPRINTF((message ("called uentry_getFunctionConditions on nonfunction %s",
+                               uentry_unparse (ue) ) ));
+             return constraintList_undefined;
            }
+         
+         
+         return constraintList_undefined;
+       }
+      
+      if (!uentry_isFunction(ue))
+       {
+         
+         DPRINTF( (message ("called uentry_getFunctionConditions on non function  %s",
+                            uentry_unparse (ue) ) ) );
+         return constraintList_undefined;
+         
+       }
 
-         if (functionConstraint_hasBufferConstraint (ue->info->fcn->postconditions))
-           {
-             DPRINTF((message ("called uentry_getFcnPostconditions on %s and returned %q",
-                               uentry_unparse (ue),
-                               constraintList_unparse (functionConstraint_getBufferConstraint (ue->info->fcn->postconditions)))));
+      llassert (uentry_isFunction (ue));
 
-             return constraintList_copy (functionConstraint_getBufferConstraint (ue->info->fcn->postconditions));
-           }
-         else
-           {
-             return NULL;
-           }
+      if (isPost)
+       {
+         constraint = ue->info->fcn->postconditions;
        }
-       
+      else
+       {
+         constraint = ue->info->fcn->preconditions;
+       }
+
+      return functionConstraint_getBufferConstraints (constraint);
     }
   
   return constraintList_undefined;
   
 }
 
+/*drl7x*/
+/*@only@*/ constraintList uentry_getFcnPreconditions (uentry ue)
+{
+  return uentry_getFunctionConditions (ue, FALSE);
+}
+
+/*drl
+  12/28/2000
+*/
+
+constraintList uentry_getFcnPostconditions (uentry ue)
+{
+  return uentry_getFunctionConditions (ue, TRUE);
+}
 
 static /*@only@*/ fileloc setLocation (void)
 {
@@ -671,6 +644,12 @@ static /*@only@*/ fileloc setLocation (void)
     }
 }
 
+static void uentry_setConstantValue (uentry ue, /*@only@*/ multiVal val)
+{
+  llassert (uentry_isEitherConstant (ue));
+  sRef_setValue (ue->sref, val);
+}
+
 /*@notnull@*/ uentry uentry_makeEnumConstant (cstring n, ctype t)
 {
   fileloc loc = setLocation ();
@@ -915,6 +894,8 @@ uentry_makeFunctionAux (cstring n, ctype t,
 
   llassert (warnClause_isUndefined (warn)); /*@i325 remove parameter! */
 
+  DPRINTF (("Make function: %s", n));
+
   if (ctype_isFunction (t))
     {
       ret = ctype_getReturnType (t);
@@ -946,7 +927,9 @@ uentry_makeFunctionAux (cstring n, ctype t,
   e->utype = t;
   e->storageclass = SCNONE;
 
-    e->sref = sRef_makeType (ret);
+  e->sref = sRef_makeResult (ret); /* evans 2001-07-19 - was sRef_makeType */
+
+  DPRINTF (("Result: %s", sRef_unparseFull (e->sref)));
 
   if (ctype_isUA (ret))
     {
@@ -1091,6 +1074,8 @@ static void uentry_reflectClauses (uentry ue, functionClauseList clauses)
       else if (functionClause_isEnsures (el))
        {
          functionConstraint cl = functionClause_takeEnsures (el);
+         DPRINTF (("Setting post: %s / %s",
+                   uentry_unparse (ue), functionConstraint_unparse (cl)));
          uentry_setPostconditions (ue, cl);
        }
       else if (functionClause_isRequires (el))
@@ -1101,6 +1086,32 @@ static void uentry_reflectClauses (uentry ue, functionClauseList clauses)
       else if (functionClause_isState (el))
        {
          stateClause sc = functionClause_takeState (el);
+
+         if (stateClause_isBefore (sc) && stateClause_setsMetaState (sc))
+           {
+             sRefSet rfs = stateClause_getRefs (sc);
+
+             sRefSet_elements (rfs, s)
+               {
+                 if (sRef_isParam (s))
+                   {
+                     /* 
+                     ** Can't use requires on parameters
+                     */
+                     
+                     voptgenerror
+                       (FLG_ANNOTATIONERROR,
+                        message ("Requires clauses for %q concerns parameters %q should be "
+                                 "a parameter annotation instead: %q",
+                                 uentry_unparse (ue),
+                                 sRef_unparse (s),
+                                 stateClause_unparse (sc)),
+                        stateClause_loc (sc));
+                   }
+               } end_sRefSet_elements ;
+           }
+
+         DPRINTF (("State clause: %s", stateClause_unparse (sc)));
          uentry_addStateClause (ue, sc);
        }
       else if (functionClause_isWarn (el))
@@ -1114,6 +1125,7 @@ static void uentry_reflectClauses (uentry ue, functionClauseList clauses)
        }
     } end_functionClauseList_elements ;
 
+  DPRINTF (("Checking all: %s", sRef_unparseFull (ue->sref)));
   stateClauseList_checkAll (ue);
 }
 
@@ -1126,6 +1138,8 @@ static void uentry_reflectClauses (uentry ue, functionClauseList clauses)
                         sRefSet_undefined, warnClause_undefined,
                         setLocation ());
 
+  DPRINTF (("Id function: %s", sRef_unparseFull (ue->sref)));
+
   /*
   ** This makes parameters names print out correctly.
   ** (But we might be a local variable declaration for a function type...)
@@ -1143,10 +1157,13 @@ static void uentry_reflectClauses (uentry ue, functionClauseList clauses)
       leaveFunc = TRUE;
     }
 
+  DPRINTF (("Id function: %s", sRef_unparseFull (ue->sref)));
   uentry_reflectQualifiers (ue, idDecl_getQuals (id));
+  DPRINTF (("Id function: %s", sRef_unparseFull (ue->sref)));
   reflectImplicitFunctionQualifiers (ue, FALSE);
-
+  DPRINTF (("Id function: %s", sRef_unparseFull (ue->sref)));
   uentry_reflectClauses (ue, idDecl_getClauses (id));
+  DPRINTF (("Id function: %s", sRef_unparseFull (ue->sref)));
 
   if (!uentry_isStatic (ue)
       && cstring_equalLit (ue->uname, "main"))
@@ -1255,13 +1272,14 @@ static void uentry_implicitParamAnnots (/*@notnull@*/ uentry e)
 }
 
 static /*@only@*/ /*@notnull@*/ uentry 
-uentry_makeVariableParamAux (cstring n, ctype t, /*@dependent@*/ sRef s, sstate defstate) /*@i32 exposed*/
+uentry_makeVariableParamAux (cstring n, ctype t, /*@dependent@*/ sRef s, 
+                            /*@only@*/ fileloc loc, sstate defstate) /*@i32 exposed*/
 {
   cstring pname = makeParam (n);
   uentry e;
 
   DPRINTF (("Sref: %s", sRef_unparseFull (s)));
-  e = uentry_makeVariableAux (pname, t, setLocation (), s, FALSE, VKPARAM);
+  e = uentry_makeVariableAux (pname, t, loc, s, FALSE, VKPARAM);
 
   cstring_free (pname);
   DPRINTF (("Param: %s", uentry_unparseFull (e)));
@@ -1393,9 +1411,9 @@ void checkGlobalsModifies (/*@notnull@*/ uentry ue, sRefSet sr)
 }
 
 uentry
-uentry_makeVariableSrefParam (cstring n, ctype t, /*@exposed@*/ sRef s)
+uentry_makeVariableSrefParam (cstring n, ctype t, /*@only@*/ fileloc loc, /*@exposed@*/ sRef s)
 {
-  return (uentry_makeVariableParamAux (n, t, s, SS_UNKNOWN));
+  return (uentry_makeVariableParamAux (n, t, s, loc, SS_UNKNOWN));
 }
 
 void
@@ -1418,6 +1436,7 @@ uentry_fixupSref (uentry ue)
   
   if (uentry_isVariable (ue))
     {
+      /*@i634    ue->sref = sRef_saveCopyShallow (ue->info->var->origsref); */
       sRef_setDefState (sr, ue->info->var->defstate, fileloc_undefined);
       sRef_setNullState (sr, ue->info->var->nullstate, fileloc_undefined);
     }
@@ -1495,11 +1514,7 @@ uentry_setModifies (uentry ue, /*@owned@*/ sRefSet sr)
        }
       else
        {
-         if (uentry_isVariable (ue) && ctype_isFunction (uentry_getType (ue)))
-           {
-             uentry_makeVarFunction (ue);
-           }
-         
+         uentry_convertVarFunction (ue);
          llassertfatal (uentry_isFunction (ue));
          llassert (sRefSet_isUndefined (ue->info->fcn->mods));
          
@@ -1591,26 +1606,31 @@ uentry_setPreconditions (uentry ue, /*@only@*/ functionConstraint preconditions)
 
   if (uentry_isValid (ue))
     {
-      {
-       if (uentry_isVariable (ue) && ctype_isFunction (uentry_getType (ue)))
-         {
-           uentry_makeVarFunction (ue);
-         }
-       
-       llassertfatal (uentry_isFunction (ue));
-       
-       if (functionConstraint_isDefined (ue->info->fcn->preconditions))
-         {
-           BADBRANCH; /* should conjoin constraints? */
-           functionConstraint_free (ue->info->fcn->preconditions);
-           ue->info->fcn->preconditions = preconditions;
-         }
-       else
-         {
-           ue->info->fcn->preconditions = preconditions;
-         }
-      }
+      uentry_convertVarFunction (ue);
+      llassertfatal (uentry_isFunction (ue));
       
+      if (functionConstraint_isDefined (ue->info->fcn->preconditions))
+       {
+         /* drl 11-29-2001
+            I changed this so it didn't appear as a Splint bug
+            among other things this gets triggered when there is
+            a function with two requires clauses.  Now Splint
+            prints an error and tries to conjoin the lists.
+         */
+      llparseerror
+       (message ("Duplicate precondition list"
+                 "Attemping the conjoin the requires clauses"
+                 ));
+
+
+         /* should conjoin constraints? */
+         /*@notreached@*/ 
+         ue->info->fcn->preconditions = functionConstraint_conjoin (ue->info->fcn->preconditions, preconditions);
+       }
+      else
+       {
+         ue->info->fcn->preconditions = preconditions;
+       }
     }
   else
     {
@@ -1637,25 +1657,17 @@ uentry_setPostconditions (uentry ue, /*@only@*/ functionConstraint postcondition
 
   if (uentry_isValid (ue))
     {
-      {
-       if (uentry_isVariable (ue) && ctype_isFunction (uentry_getType (ue)))
-         {
-           uentry_makeVarFunction (ue);
-         }
-       
-       llassertfatal (uentry_isFunction (ue));
-       
-       if (functionConstraint_isUndefined (ue->info->fcn->postconditions))
-         {
-           ue->info->fcn->postconditions = postconditions;
-         }
-       else
-         {
-           BADBRANCH; /* should conjoin */
-           functionConstraint_free (ue->info->fcn->postconditions);
-           ue->info->fcn->postconditions = postconditions;
-         }         
-      }
+      uentry_convertVarFunction (ue);
+      llassertfatal (uentry_isFunction (ue));
+      
+      if (functionConstraint_isUndefined (ue->info->fcn->postconditions))
+       {
+         ue->info->fcn->postconditions = postconditions;
+       }
+      else
+       {
+         ue->info->fcn->postconditions = functionConstraint_conjoin (ue->info->fcn->postconditions, postconditions);
+       }           
     }
   else
     {
@@ -2344,11 +2356,8 @@ uentry_reflectOtherQualifier (/*@notnull@*/ uentry ue, qual qel)
     }
   else if (qual_isNullPred (qel))
     {
-      if (uentry_isVariable (ue) && ctype_isFunction (uentry_getType (ue)))
-       {
-         uentry_makeVarFunction (ue);
-       }
-      
+      uentry_convertVarFunction (ue);
+
       if (uentry_isFunction (ue))
        {
          ctype typ = uentry_getType (ue);
@@ -2443,7 +2452,7 @@ uentry_reflectOtherQualifier (/*@notnull@*/ uentry ue, qual qel)
        {
          if (optgenerror
              (FLG_ANNOTATIONERROR,
-              message ("Meta state anntation %s used in inconsistent context: %q",
+              message ("Attribute annotation %s used in inconsistent context: %q",
                        qual_unparse (qel),
                        uentry_unparse (ue)),
               uentry_whereLast (ue)))
@@ -2470,6 +2479,9 @@ uentry_reflectQualifiers (uentry ue, qualList q)
 {
   llassert (uentry_isValid (ue)); 
 
+  DPRINTF (("Reflect qualifiers: %s / %s",
+           uentry_unparseFull (ue), qualList_unparse (q)));
+
   qualList_elements (q, qel)
     {
       if (qual_isStatic (qel))
@@ -2790,6 +2802,8 @@ uentry_reflectQualifiers (uentry ue, qualList q)
     } end_qualList_elements;
 
   qualList_clear (q);
+
+  DPRINTF (("Done: %s", sRef_unparseFull (ue->sref)));
 }
        
 bool
@@ -2977,11 +2991,7 @@ static void checkSpecialFunction (/*@notnull@*/ uentry ue)
 void
 uentry_setPrintfLike (uentry ue)
 {
-  if (uentry_isVariable (ue) && ctype_isFunction (uentry_getType (ue)))
-    {
-      uentry_makeVarFunction (ue);
-    }
-  
+  uentry_convertVarFunction (ue);
   llassertfatal (uentry_isFunction (ue));
   ue->info->fcn->specialCode = SPC_PRINTFLIKE;
   checkSpecialFunction (ue);
@@ -2990,11 +3000,7 @@ uentry_setPrintfLike (uentry ue)
 void
 uentry_setScanfLike (uentry ue)
 {
-  if (uentry_isVariable (ue) && ctype_isFunction (uentry_getType (ue)))
-    {
-      uentry_makeVarFunction (ue);
-    }
-  
+  uentry_convertVarFunction (ue);
   llassertfatal (uentry_isFunction (ue));
   ue->info->fcn->specialCode = SPC_SCANFLIKE;
   checkSpecialFunction (ue);
@@ -3003,11 +3009,7 @@ uentry_setScanfLike (uentry ue)
 void
 uentry_setMessageLike (uentry ue)
 {
-  if (uentry_isVariable (ue) && ctype_isFunction (uentry_getType (ue)))
-    {
-      uentry_makeVarFunction (ue);
-    }
-  
+  uentry_convertVarFunction (ue);  
   llassertfatal (uentry_isFunction (ue));
   ue->info->fcn->specialCode = SPC_MESSAGELIKE;
   checkSpecialFunction (ue);
@@ -3024,9 +3026,11 @@ uentry_isSpecialFunction (uentry ue)
 {
   ctype ct = idDecl_getCtype (t);
   ctype base = ct;
-  sRef pref = sRef_makeParam (i, ct);
-  uentry ue = uentry_makeVariableSrefParam (idDecl_observeId (t), ct, pref);
+  fileloc loc = setLocation ();
+  sRef pref = sRef_makeParam (i, ct, stateInfo_makeLoc (loc));
+  uentry ue = uentry_makeVariableSrefParam (idDecl_observeId (t), ct, loc, pref);
 
+  DPRINTF (("Make param: %s", uentry_unparseFull (ue)));
   uentry_reflectQualifiers (ue, idDecl_getQuals (t));
   uentry_implicitParamAnnots (ue);
 
@@ -3085,9 +3089,9 @@ uentry_isSpecialFunction (uentry ue)
 }
 
 # ifndef NOLCL
-/*@notnull@*/ uentry uentry_makeVariableParam (cstring n, ctype t)
+/*@notnull@*/ uentry uentry_makeVariableParam (cstring n, ctype t, fileloc loc)
 {
-  return (uentry_makeVariableParamAux (n, t, sRef_makeType (t), SS_DEFINED));
+  return (uentry_makeVariableParamAux (n, t, sRef_makeType (t), fileloc_copy (loc), SS_DEFINED));
 }
 # endif
 
@@ -3120,7 +3124,6 @@ uentry uentry_makeConstantAux (cstring n, ctype t,
 
   e->info = (uinfo) dmalloc (sizeof (*e->info));
   e->info->uconst = (ucinfo) dmalloc (sizeof (*e->info->uconst));
-  e->info->uconst->val = m;
   e->info->uconst->access = typeIdSet_undefined;
 
   uentry_setSpecDef (e, f);
@@ -3130,6 +3133,8 @@ uentry uentry_makeConstantAux (cstring n, ctype t,
       sRef_setDefNull (e->sref, uentry_whereDeclared (e)); 
     }
 
+  uentry_setConstantValue (e, m);
+
   return (e);
 }
 
@@ -3146,9 +3151,10 @@ uentry uentry_makeConstantAux (cstring n, ctype t,
 
   llassert (fileloc_isUndefined (ue->whereDeclared));
   ue->whereDeclared = setLocation ();
-
   uentry_reflectQualifiers (ue, idDecl_getQuals (t));
 
+  DPRINTF (("Constant: %s", uentry_unparseFull (ue)));
+  DPRINTF (("Value: %s", multiVal_unparse (uentry_getConstantValue (ue))));
   return ue;
 }
 
@@ -3267,6 +3273,7 @@ static /*@only@*/ /*@notnull@*/
   e->info->var = (uvinfo) dmalloc (sizeof (*e->info->var));
   e->info->var->kind = kind;
 
+  /*@i523 e->info->var->origsref = sRef_saveCopy (e->sref); */
   e->info->var->checked = CH_UNKNOWN;
 
   DPRINTF (("Here we are: %s", sRef_unparseFull (e->sref)));
@@ -3288,11 +3295,11 @@ static /*@only@*/ /*@notnull@*/
   e->info->var->defstate = sRef_getDefState (e->sref);  
   e->info->var->nullstate = sRef_getNullState (e->sref);
 
-/* start modifications */
-/* This function sets the uentry for a pointer or array variable declaration,
-   it allocates memory and sets the fields. We check if the type of the variable
-   is a pointer or array and allocate a `bbufinfo' struct accordingly */
-
+  /* start modifications */
+  /* This function sets the uentry for a pointer or array variable declaration,
+     it allocates memory and sets the fields. We check if the type of the variable
+     is a pointer or array and allocate a `bbufinfo' struct accordingly */
+  
   if( ctype_isArray (t) || ctype_isPointer(t)) {
     /*@i222@*/e->info->var->bufinfo = dmalloc( sizeof(*e->info->var->bufinfo) );
      e->info->var->bufinfo->bufstate = BB_NOTNULLTERMINATED;
@@ -3348,6 +3355,7 @@ void uentry_makeVarFunction (uentry ue)
   ak = sRef_getOrigAliasKind (ue->sref);
   ek = sRef_getOrigExKind (ue->sref);
 
+  llassert (uentry_isVariable (ue));
   oldInfo = ue->info->var;
 
   llassert (ctype_isUnknown (ue->utype) || ctype_isFunction (ue->utype));
@@ -3356,7 +3364,7 @@ void uentry_makeVarFunction (uentry ue)
   ** expanded macro is marked used (until I write a pre-processor)
   */
 
-  ue->used |= (oldInfo->kind == VKEXPMACRO);
+  ue->used = ue->used || (oldInfo->kind == VKEXPMACRO);
 
   ue->ukind = KFCN;
   ue->info->fcn = (ufinfo) dmalloc (sizeof (*ue->info->fcn));
@@ -3376,9 +3384,8 @@ void uentry_makeVarFunction (uentry ue)
   /*end */
 
   /*drl 12/28/2000*/
-  ue->info->fcn->postconditions = functionConstraint_undefined;
+  ue->info->fcn->postconditions = functionConstraint_undefined; 
   /*end */
-
   
   if (ctype_isFunction (ue->utype))
     {
@@ -3440,8 +3447,7 @@ void uentry_makeVarFunction (uentry ue)
 
   if (oldInfo->kind == VKEXPMACRO)
     {
-      fileloc_free (loc);
-      ue->whereDeclared = fileloc_undefined;
+      ;
     }
   else
     {
@@ -3452,6 +3458,111 @@ void uentry_makeVarFunction (uentry ue)
   uvinfo_free (oldInfo);
 }
 
+void uentry_makeConstantFunction (uentry ue)
+{
+  alkind ak;
+  exkind ek;
+  ucinfo oldInfo;
+  fileloc loc;
+
+  llassert (uentry_isValid (ue));
+  llassert (!sRef_modInFunction ());
+
+  ak = sRef_getOrigAliasKind (ue->sref);
+  ek = sRef_getOrigExKind (ue->sref);
+
+  llassert (uentry_isConstant (ue));
+  oldInfo = ue->info->uconst;
+
+  llassert (ctype_isUnknown (ue->utype) || ctype_isFunction (ue->utype));
+
+  /*
+  ** expanded macro is marked used (until I write a pre-processor)
+  */
+
+  ue->ukind = KFCN;
+  ue->info->fcn = (ufinfo) dmalloc (sizeof (*ue->info->fcn));
+  ue->info->fcn->exitCode = XK_UNKNOWN;
+  ue->info->fcn->nullPred = qual_createUnknown ();
+  ue->info->fcn->specialCode = SPC_NONE;
+  ue->info->fcn->access = typeIdSet_undefined;
+  ue->info->fcn->hasGlobs = FALSE;
+  ue->info->fcn->globs = globSet_undefined;
+  ue->info->fcn->hasMods = FALSE;
+  ue->info->fcn->mods = sRefSet_undefined;
+  ue->info->fcn->specclauses = NULL;
+  ue->info->fcn->defparams = uentryList_undefined;
+
+  /*drl*/
+  ue->info->fcn->preconditions = functionConstraint_undefined;
+  /*end */
+
+  /*drl 12/28/2000*/
+  ue->info->fcn->postconditions = functionConstraint_undefined;
+  /*end */
+
+  
+  if (ctype_isFunction (ue->utype))
+    {
+      ue->sref = sRef_makeType (ctype_getReturnType (ue->utype)); 
+    }
+  else
+    {
+      ue->sref = sRef_makeType (ctype_unknown); 
+    }
+
+  if (sRef_isRefCounted (ue->sref))
+    {
+      ak = AK_NEWREF;
+    }
+  else
+    {
+      if (alkind_isUnknown (ak))
+       {
+         if (exkind_isKnown (ek))
+           {
+             DPRINTF (("imp dep: %s", uentry_unparseFull (ue)));
+             ak = AK_IMPDEPENDENT;
+           }
+         else 
+           {
+             if (context_getFlag (FLG_RETIMPONLY))
+               {
+                 if (ctype_isFunction (ue->utype)
+                     && ctype_isVisiblySharable 
+                     (ctype_realType (ctype_getReturnType (ue->utype))))
+                   {
+                     if (uentryList_hasReturned (uentry_getParams (ue)))
+                       {
+                         ;
+                       }
+                     else
+                       {
+                         if (ctype_isImmutableAbstract (ctype_getReturnType (ue->utype))) 
+                           {
+                             ;
+                           }
+                         else 
+                           {
+                             ak = AK_IMPONLY;
+                           }
+                       }
+                   }
+               }
+           }
+       }
+    }
+
+  loc = ue->whereDeclared;
+
+  sRef_setAliasKind (ue->sref, ak, loc);
+  sRef_setExKind (ue->sref, ek, loc);
+
+  fileloc_free (ue->whereDefined);
+  ue->whereDefined = fileloc_undefined;
+  ucinfo_free (oldInfo);
+}
+
 void
 uentry_setGlobals (uentry ue, /*@owned@*/ globSet globs)
 {
@@ -3464,10 +3575,7 @@ uentry_setGlobals (uentry ue, /*@owned@*/ globSet globs)
     }
   else
     {
-      if (uentry_isVariable (ue) && ctype_isFunction (uentry_getType (ue)))
-       {
-         uentry_makeVarFunction (ue);
-       }
+      uentry_convertVarFunction (ue);
       
       llassert (uentry_isFunction (ue));
       llassert (!ue->info->fcn->hasGlobs 
@@ -3479,7 +3587,8 @@ uentry_setGlobals (uentry ue, /*@owned@*/ globSet globs)
       /*@=mustfree@*/
     }
 
-  /*@i23 ??? 
+  /*@i23*/
+  /* ???  - evans 2001-09-09 not sure what's going on here...?
   if (globSet_hasStatic (globs))
     {
       context_recordFileGlobals (globs);
@@ -4049,8 +4158,8 @@ uentry_compare (uentry u1, uentry u2)
       return 0;
     case KENUMCONST:
     case KCONST:
-      return (multiVal_compare (u1->info->uconst->val,
-                               u2->info->uconst->val));
+      return (multiVal_compare (uentry_getConstantValue (u1),
+                               uentry_getConstantValue (u2)));
     case KSTRUCTTAG: 
     case KUNIONTAG: 
     case KENUMTAG: 
@@ -4068,7 +4177,7 @@ uentry_compare (uentry u1, uentry u2)
       ** Functions are never equivalent
       */
       
-      if ((int) u1 < (int) u2)
+      if (u1 - u2 < 0) /* evans 2001-08-21: was: ((int) u1 < (int) u2), changed to remove gcc warning */
        {
          return -1;
        }
@@ -4169,9 +4278,9 @@ static uentry
 
   e->info = (uinfo) dmalloc (sizeof (*e->info));
   e->info->uconst = (ucinfo) dmalloc (sizeof (*e->info->uconst));
-  e->info->uconst->val = m;
   e->info->uconst->access = access;
 
+  uentry_setConstantValue (e, m);
   sRef_storeState (e->sref);
 
   return (e);
@@ -4349,6 +4458,13 @@ bool uentry_hasStateClauseList (uentry ue)
   return (uentry_isFunction (ue) && stateClauseList_isDefined (ue->info->fcn->specclauses));
 }
 
+bool uentry_hasConditions (uentry ue)
+{
+  return (uentry_isFunction (ue) 
+         && (functionConstraint_isDefined (ue->info->fcn->preconditions)
+             || functionConstraint_isDefined (ue->info->fcn->postconditions)));
+}
+
 stateClauseList uentry_getStateClauseList (uentry ue)
 {
   if (!uentry_isFunction (ue))
@@ -5109,7 +5225,7 @@ uentry_dumpAux (uentry v, bool isParam)
       {
        cstring sdump;
 
-       if (multiVal_isUnknown (v->info->uconst->val)
+       if (multiVal_isUnknown (uentry_getConstantValue (v))
            && typeIdSet_isEmpty (uentry_accessType (v))
            && (sRef_getNullState (v->sref) == NS_UNKNOWN))
          {
@@ -5118,7 +5234,7 @@ uentry_dumpAux (uentry v, bool isParam)
        else
          {
            sdump = message ("@%q@%q@%d",
-                            multiVal_dump (v->info->uconst->val),
+                            multiVal_dump (uentry_getConstantValue (v)),
                             typeIdSet_dump (uentry_accessType (v)),
                             (int) sRef_getNullState (v->sref));
          }
@@ -5206,12 +5322,14 @@ uentry_unparseFull (uentry v)
       else if (uentry_isFunction (v))
        {
          res = message ("%q / sref: %q / mods: %q / "
-                        "globs: %q / clauses: %q",
+                        "globs: %q / clauses: %q / pre: %q / post: %q",
                         res,
                         sRef_unparseFull (v->sref),
                         sRefSet_unparse (v->info->fcn->mods),
                         globSet_unparse  (v->info->fcn->globs),
-                        stateClauseList_unparse (v->info->fcn->specclauses));
+                        stateClauseList_unparse (v->info->fcn->specclauses),
+                        functionConstraint_unparse (v->info->fcn->preconditions),
+                        functionConstraint_unparse (v->info->fcn->postconditions));
        }
       else if (uentry_isIter (v))
        {
@@ -5232,6 +5350,11 @@ uentry_unparseFull (uentry v)
          DPRINTF (("sref: %s", sRef_unparseDebug (v->sref)));
          /* DPRINTF (("sref: %s", sRef_unparseDeep (v->sref)));           */
        }
+      else if (uentry_isConstant (v))
+       {
+         res = message ("%q = %q",
+                        res, multiVal_unparse (uentry_getConstantValue (v)));
+       }
       else
        {
          res = message ("%q :: %q", res, uentry_unparse (v));
@@ -5622,9 +5745,8 @@ uentry_getKind (uentry e)
 
 /*@observer@*/ multiVal uentry_getConstantValue (uentry e)
 {
-  llassert (uentry_isEitherConstant (e));
-
-  return (e->info->uconst->val);
+  llassert (uentry_isEitherConstant (e)); 
+  return (sRef_getValue (e->sref));
 }
 
 /*@observer@*/ uentryList
@@ -6008,7 +6130,9 @@ uentry_setDefined (uentry e, fileloc f)
 bool
 uentry_isCodeDefined (uentry e)
 {
-  return (uentry_isValid (e) && fileloc_isDefined (e->whereDefined));
+  llassert (uentry_isValid (e));
+
+  return (fileloc_isDefined (e->whereDefined));
 }
 
 bool
@@ -6034,6 +6158,28 @@ sRef uentry_getSref (uentry e)
 
 sRef uentry_getOrigSref (uentry e)
 {
+  /*@i523*/ /* evans 2001-09-09 - need to fix this 
+  if (uentry_isValid (e))
+    {
+      if (uentry_isVariable (e))
+       {
+         return e->info->var->origsref;
+       }
+      else
+       {
+         sRef sr = sRef_copy (uentry_getSref (e));
+         
+         sRef_resetState (sr);
+         sRef_clearDerived (sr);
+         return (sr);
+       }
+    }
+  else
+    {
+      return sRef_undefined;
+    }
+  */
+
   if (uentry_isValid (e))
     {
       sRef sr = sRef_copy (uentry_getSref (e));
@@ -6086,15 +6232,11 @@ uentry_resetParams (uentry ue, /*@only@*/ uentryList pn)
   
   llassert (uentry_isValid (ue));
 
-  rct = ctype_realType (ue->utype);
-
-  if (uentry_isVariable (ue) && (ctype_isFunction (rct) || ctype_isUnknown (rct)))
-    {
-      uentry_makeVarFunction (ue);
-    }
-
+  uentry_convertVarFunction (ue);
   llassert (uentry_isFunction (ue));
 
+  rct = ctype_realType (ue->utype);
+
   if (ctype_isFunction (rct))
     {
       rettype = ctype_getReturnType (rct);
@@ -6106,7 +6248,6 @@ uentry_resetParams (uentry ue, /*@only@*/ uentryList pn)
 void
 uentry_setRefParam (uentry e)
 {
-  
   if (!uentry_isVar (e))
     {
       llbug (message ("uentry_setParam: not variable: %q", uentry_unparse (e)));
@@ -6405,12 +6546,13 @@ uentry_setSpecDef (/*@special@*/ uentry e, /*@keep@*/ fileloc f)
       e->whereDeclared  = f;
       e->whereDefined  = fileloc_undefined;
     }
+
+  llassert (fileloc_storable (f));
 }
 
 static void
 ucinfo_free (/*@only@*/ ucinfo u)
 {
-  multiVal_free (u->val);
   sfree (u);
 }
 
@@ -6418,9 +6560,7 @@ static void
 uvinfo_free (/*@only@*/ uvinfo u)
 {
   /*drl7x added 6/29/01 */
-  /*free null terminated stuff */
-  /*@i22*/
-  //  free(u->bufinfo);
+  free (u->bufinfo); /* evans - 2001-07-19 fixed this bug */
   sfree (u);
 }
 
@@ -6455,10 +6595,7 @@ static /*@only@*/ ucinfo
 ucinfo_copy (ucinfo u)
 {
   ucinfo ret = (ucinfo) dmalloc (sizeof (*ret));
-  
-  ret->val = multiVal_copy (u->val);
   ret->access = u->access;
-
   return ret;
 }
 
@@ -6472,6 +6609,8 @@ uvinfo_copy (uvinfo u)
   ret->defstate = u->defstate;
   ret->checked = u->checked;
 
+  /*@i523 ret->origsref = sRef_copy (u->origsref); */
+
   /* drl added 07-02-001 */
   /* copy null terminated information */
 
@@ -6726,7 +6865,7 @@ KindConformanceError (/*@unique@*/ uentry old, uentry unew, bool mustConform)
        }
     }
 
-  uentry_copyInto (old, unew);
+  uentry_updateInto (old, unew);
 }
 
 /*
@@ -7153,6 +7292,10 @@ paramTypeError (uentry old, uentry oldCurrent, ctype oldType,
   
   if (hasError)
     {
+      DPRINTF (("Here: %s / %s",
+               uentry_unparseFull (oldCurrent),
+               uentry_unparseFull (newCurrent)));
+
       if (!uentry_isUndefined (oldCurrent))
        {
          if (!uentry_isUndefined (newCurrent) 
@@ -7405,10 +7548,6 @@ void checkDefState (/*@notnull@*/ uentry old, /*@notnull@*/ uentry unew,
       && newState != SS_UNKNOWN 
       && newState != SS_DEFINED)
     {
-      DPRINTF (("Where declared: %s / %s",
-               fileloc_unparse (uentry_whereDeclared (unew)),
-               bool_unparse (fileloc_isXHFile (uentry_whereDeclared (unew)))));
-
       if (mustConform)
        {
          if (optgenerror 
@@ -7702,24 +7841,45 @@ checkMetaState (/*@notnull@*/ uentry old, /*@notnull@*/ uentry unew,
                        }
                      else
                        {
-                         if (!stateValue_isError (newval))
+                         if (!stateValue_isError (newval) 
+                             && !stateValue_isImplicit (newval))
                            {
-                             if (mustConform 
-                                 && optgenerror 
-                                 (FLG_INCONDEFS,
-                                  message ("%s %q inconsistently %rdeclared %s %s, %s as %s",
-                                           uentry_ekindName (unew),
-                                           uentry_getName (unew),
-                                           uentry_isDeclared (old),
-                                           fcnErrName (unew),
-                                           metaStateInfo_unparseValue (msinfo, 
-                                                                       stateValue_getValue (newval)),
-                                           uentry_specOrDefName (old),
-                                           metaStateInfo_unparseValue (msinfo,
-                                                                       stateValue_getValue (oldval))),
-                                  uentry_whereDeclared (unew)))
+                             if (uentry_hasName (unew)
+                                 || !sRef_isParam (uentry_getSref (unew)))
+                               {
+                                 if (mustConform 
+                                     && optgenerror 
+                                     (FLG_INCONDEFS,
+                                      message ("%s %q inconsistently %rdeclared %s %q, %s as %q",
+                                               uentry_ekindName (unew),
+                                               uentry_getName (unew),
+                                               uentry_isDeclared (old),
+                                               fcnErrName (unew),
+                                               stateValue_unparseValue (newval, msinfo),
+                                               uentry_specOrDefName (old),
+                                               stateValue_unparseValue (oldval, msinfo)),
+                                      uentry_whereDeclared (unew)))
+                                   {
+                                     uentry_showWhereSpecified (old);
+                                   }
+                               }
+                             else
                                {
-                                 uentry_showWhereSpecified (old);
+                                 if (mustConform 
+                                     && optgenerror 
+                                     (FLG_INCONDEFS,
+                                      message ("%s %d inconsistently %rdeclared %s %q, %s as %q",
+                                               uentry_ekindName (unew),
+                                               sRef_getParam (uentry_getSref (unew)),
+                                               uentry_isDeclared (old),
+                                               fcnErrName (unew),
+                                               stateValue_unparseValue (newval, msinfo),
+                                               uentry_specOrDefName (old),
+                                               stateValue_unparseValue (oldval, msinfo)),
+                                      uentry_whereDeclared (unew)))
+                                   {
+                                     uentry_showWhereSpecified (old);
+                                   }
                                }
                            }
                        }
@@ -8025,7 +8185,7 @@ checkFunctionConformance (/*@unique@*/ /*@notnull@*/ uentry old,
   if (uentry_isForward (old))
     {
       mustConform = FALSE;
-      uentry_copyInto (old, unew);
+      uentry_updateInto (old, unew);
       return;
     }
 
@@ -8203,7 +8363,7 @@ checkFunctionConformance (/*@unique@*/ /*@notnull@*/ uentry old,
                      cstring nnamefix;
 
                      if (cstring_isDefined (pfx)
-                         && cstring_equalPrefix (oldname, cstring_toCharsSafe (pfx)))
+                         && cstring_equalPrefix (oldname, pfx))
                        {
                          oname = cstring_suffix (oldname, cstring_length (pfx));
                        }
@@ -8213,7 +8373,7 @@ checkFunctionConformance (/*@unique@*/ /*@notnull@*/ uentry old,
                        /*@-branchstate@*/ } /*@=branchstate@*/
 
                      if (cstring_isDefined (pfx)
-                         && cstring_equalPrefix (nname, cstring_toCharsSafe (pfx)))
+                         && cstring_equalPrefix (nname, pfx))
                        {
                          nnamefix = cstring_suffix (nname, cstring_length (pfx));
                        }
@@ -8366,9 +8526,6 @@ checkFunctionConformance (/*@unique@*/ /*@notnull@*/ uentry old,
       /*@=branchstate@*/ /*@i23 shouldn't need this@*/
     }
 
-  DPRINTF (("After state: %s",
-           uentry_unparseFull (old)));
-
   if (fileloc_isUndefined (old->whereDeclared))
     {
       old->whereDeclared = fileloc_copy (unew->whereDeclared);
@@ -8391,7 +8548,8 @@ uentry_mergeConstantValue (uentry ue, /*@only@*/ multiVal m)
   llassert (uentry_isValid (ue));
   llassert (uentry_isEitherConstant (ue));
 
-  uval = ue->info->uconst->val;
+  DPRINTF (("Constant value: %s / %s", uentry_unparse (ue), multiVal_unparse (m)));
+  uval = uentry_getConstantValue (ue);
 
   if (multiVal_isDefined (uval))
     {
@@ -8415,8 +8573,7 @@ uentry_mergeConstantValue (uentry ue, /*@only@*/ multiVal m)
     }
   else
     {
-      ue->info->uconst->val = m;
-      multiVal_free (uval);
+      uentry_setConstantValue (ue, m);
     }
 }
 
@@ -8733,14 +8890,14 @@ uentry_checkConstantConformance (/*@notnull@*/ uentry old,
                                 bool mustConform, 
                                 /*@unused@*/ bool completeConform)
 {
-  multiVal oldVal = old->info->uconst->val;
-  multiVal newVal = unew->info->uconst->val;
+  multiVal oldval = uentry_getConstantValue (old);
+  multiVal newval = uentry_getConstantValue (unew);
   
-  if (multiVal_isDefined (oldVal))
+  if (multiVal_isDefined (oldval))
     {
-      if (multiVal_isDefined (newVal))
+      if (multiVal_isDefined (newval))
        {
-         if (!multiVal_equiv (oldVal, newVal))
+         if (!multiVal_equiv (oldval, newval))
            {
              if (mustConform
                  && optgenerror 
@@ -8749,15 +8906,14 @@ uentry_checkConstantConformance (/*@notnull@*/ uentry old,
                            ekind_capName (unew->ukind),
                            uentry_getName (unew), 
                            uentry_isDeclared (old),
-                           multiVal_unparse (newVal)),
+                           multiVal_unparse (newval)),
                   uentry_whereDeclared (unew)))
                {
-                 uentry_showWhereLastExtra (old, multiVal_unparse (oldVal));
+                 uentry_showWhereLastExtra (old, multiVal_unparse (oldval));
                }
            }
          
-         unew->info->uconst->val = multiVal_copy (oldVal);
-         multiVal_free (newVal);
+         uentry_setConstantValue (unew, multiVal_copy (oldval));
        }
       else
        {
@@ -8766,7 +8922,7 @@ uentry_checkConstantConformance (/*@notnull@*/ uentry old,
     }
   else
     {
-      old->info->uconst->val = multiVal_copy (newVal);
+      uentry_setConstantValue (old, multiVal_copy (newval));
     }
 }
 
@@ -8800,14 +8956,14 @@ uentry_checkConformance (/*@unique@*/ /*@notnull@*/ uentry old,
          ** When a function is defined with an unparam macro
          */
 
-         uentry_copyInto (old, unew);
+         uentry_updateInto (old, unew);
          return;
        }
 
       if (uentry_isExpandedMacro (old) 
          && uentry_isEitherConstant (unew))
        {
-         uentry_copyInto (old, unew);
+         uentry_updateInto (old, unew);
          return;
        }
 
@@ -8834,7 +8990,7 @@ uentry_checkConformance (/*@unique@*/ /*@notnull@*/ uentry old,
                    }
                }
 
-             uentry_copyInto (old, unew);
+             uentry_updateInto (old, unew);
              return;
            }
          else
@@ -8871,7 +9027,7 @@ uentry_checkConformance (/*@unique@*/ /*@notnull@*/ uentry old,
                                                              old->whereDefined);
                        }
 
-                     uentry_copyInto (old, unew);
+                     uentry_updateInto (old, unew);
                      old->used = unew->used = TRUE;
                      return;
                    }
@@ -9038,6 +9194,84 @@ uentry_checkConformance (/*@unique@*/ /*@notnull@*/ uentry old,
   sRef_storeState (unew->sref);
 }
 
+static void uentry_mergeConstraints (uentry spec, uentry def)
+{
+  if (uentry_isFunction (def))
+    {
+      DPRINTF (("Here: %s / %s",
+               uentry_unparseFull (spec),
+               uentry_unparseFull (def)));
+      /* evans 2001-07-21 */
+      llassert (uentry_isFunction (spec));
+
+      if (functionConstraint_isDefined (def->info->fcn->preconditions))
+       {
+         if (fileloc_isXHFile (uentry_whereLast (def)))
+           {
+             llassert (uentry_isFunction (spec));
+             spec->info->fcn->preconditions = functionConstraint_conjoin (spec->info->fcn->preconditions,
+                                                                          def->info->fcn->preconditions);
+           }
+         else if (fileloc_equal (uentry_whereLast (spec), uentry_whereLast (def)))
+           {
+             ;
+           }
+         else
+           {
+             /* Check if the constraints are identical */
+
+             if (optgenerror 
+                 (FLG_INCONDEFS,
+                  message
+                  ("Preconditions for %q redeclared. Dropping previous precondition: %q",
+                   uentry_getName (spec),
+                   functionConstraint_unparse (spec->info->fcn->preconditions)),
+                  uentry_whereLast (def)))
+               {
+                 uentry_showWhereSpecified (spec);
+               }
+
+             functionConstraint_free (spec->info->fcn->preconditions);
+             spec->info->fcn->preconditions = def->info->fcn->preconditions;
+           }
+         
+         def->info->fcn->preconditions = functionConstraint_undefined;
+       }
+
+      if (functionConstraint_isDefined (def->info->fcn->postconditions))
+       {
+         if (fileloc_isXHFile (uentry_whereLast (def)))
+           {
+             llassert (uentry_isFunction (spec));
+             DPRINTF (("Post: %s /++/ %s",
+                       functionConstraint_unparse (spec->info->fcn->postconditions),
+                       functionConstraint_unparse (def->info->fcn->postconditions)));
+             spec->info->fcn->postconditions = functionConstraint_conjoin (spec->info->fcn->postconditions,
+                                                                           def->info->fcn->postconditions);
+             def->info->fcn->postconditions = functionConstraint_undefined;
+             DPRINTF (("Conjoined post: %s", functionConstraint_unparse (spec->info->fcn->postconditions)));
+           }
+         else
+           {
+             if (optgenerror 
+                 (FLG_INCONDEFS,
+                  message
+                  ("Postconditions for %q redeclared. Dropping previous postcondition: %q",
+                   uentry_getName (spec),
+                   functionConstraint_unparse (spec->info->fcn->postconditions)),
+                  uentry_whereLast (def)))
+               {
+                 uentry_showWhereSpecified (spec);
+               }
+             
+             functionConstraint_free (spec->info->fcn->postconditions);
+             spec->info->fcn->postconditions = def->info->fcn->postconditions;
+             def->info->fcn->postconditions = functionConstraint_undefined;
+           }
+       }
+    }
+}
+
 /*
 ** modifies spec to reflect def, reports any inconsistencies
 */
@@ -9048,11 +9282,28 @@ uentry_mergeEntries (uentry spec, /*@only@*/ uentry def)
   llassert (uentry_isValid (spec));
   llassert (uentry_isValid (def));
   llassert (cstring_equal (spec->uname, def->uname));
+
+  if (uentry_isFunction (def))
+    {
+      if (uentry_isConstant (spec))
+       {
+         llassert (ctype_isUnknown (spec->utype) || ctype_isFunction (spec->utype));
+         uentry_makeConstantFunction (spec);
+       }
+      else
+       {
+         uentry_convertVarFunction (spec);
+       }
+
+      llassert (uentry_isFunction (spec));
+    }
   
   DPRINTF (("Merge entries: %s / %s",
            uentry_unparseFull (spec),
            uentry_unparseFull (def)));
 
+  uentry_mergeConstraints (spec, def);
+
   uentry_checkConformance (spec, def, TRUE, 
                           context_getFlag (FLG_NEEDSPEC));
 
@@ -9165,7 +9416,7 @@ uentry_checkDecl (void)
 void
 uentry_mergeDefinition (uentry old, /*@only@*/ uentry unew)
 {
-  fileloc olddef = uentry_whereDeclared (old);
+  fileloc olddef = uentry_whereDeclared (old); 
   fileloc unewdef = uentry_whereDeclared (unew);
   bool mustConform;
   bool wasForward;
@@ -9174,15 +9425,10 @@ uentry_mergeDefinition (uentry old, /*@only@*/ uentry unew)
            uentry_unparseFull (old),
            uentry_unparseFull (unew)));
  
-  if (uentry_isExtern (unew))
-    {
-      uentry_setUsed (old, unewdef);
-    }
-
   wasForward = 
     fileloc_isUndefined (olddef) 
-      && fileloc_isDefined (uentry_whereDefined (old)) 
-       && !uentry_isExpandedMacro (old);
+    && fileloc_isDefined (uentry_whereDefined (old)) 
+    && !uentry_isExpandedMacro (old);
   
   if (!context_getFlag (FLG_INCONDEFSLIB)
       && (fileloc_isLib (olddef) || fileloc_isImport (olddef)))
@@ -9198,6 +9444,30 @@ uentry_mergeDefinition (uentry old, /*@only@*/ uentry unew)
   llassert (uentry_isValid (unew));
   llassert (cstring_equal (old->uname, unew->uname));
 
+  if (uentry_isFunction (unew) && !uentry_isFunction (old))
+    {
+      if (uentry_isConstant (old))
+       {
+         llassert (ctype_isUnknown (old->utype) || ctype_isFunction (old->utype));
+         uentry_makeConstantFunction (old);
+       }
+      else
+       {
+         uentry_convertVarFunction (old);
+       }
+
+      llassert (uentry_isFunction (old));
+    }
+
+  DPRINTF (("uentry merge: %s / %s",
+           uentry_unparseFull (old),
+           uentry_unparseFull (unew)));
+
+  if (uentry_isExtern (unew))
+    {
+      uentry_setUsed (old, unewdef);
+    }
+
   /*
   ** should check old one was extern!
   */
@@ -9231,7 +9501,8 @@ uentry_mergeDefinition (uentry old, /*@only@*/ uentry unew)
     }
   else
     {
-      if (!uentry_isExtern (unew) && !uentry_isForward (old)
+      if (!uentry_isExtern (unew) 
+         && !uentry_isForward (old)
          && !fileloc_equal (olddef, unewdef)
          && !fileloc_isUndefined (olddef)
          && !fileloc_isUndefined (unewdef)
@@ -9263,7 +9534,7 @@ uentry_mergeDefinition (uentry old, /*@only@*/ uentry unew)
                  /*
                  if (uentry_isDatatype (old) || uentry_isAnyTag (old))
                    {
-                     uentry_copyInto (old, unew);
+                     uentry_updateInto (old, unew);
                      old->sref = sRef_saveCopy (old->sref);
                    }
                    */
@@ -9301,13 +9572,25 @@ uentry_mergeDefinition (uentry old, /*@only@*/ uentry unew)
                }
              else
                {
-                 uentry_setDefined (old, unewdef);
+                 uentry_setDeclared (old, unewdef); /* evans 2001-07-23 was setDefined */
                }
            }
        }
     }
 
+  DPRINTF (("uentry merge: %s / %s",
+           uentry_unparseFull (old),
+           uentry_unparseFull (unew)));
+
+  uentry_mergeConstraints (old, unew);
+  DPRINTF (("uentry merge: %s / %s",
+           uentry_unparseFull (old),
+           uentry_unparseFull (unew)));
+
   uentry_checkConformance (old, unew, mustConform, FALSE);
+  DPRINTF (("uentry merge: %s / %s",
+           uentry_unparseFull (old),
+           uentry_unparseFull (unew)));
 
   old->used = old->used || unew->used;
   old->uses = filelocList_append (old->uses, unew->uses);
@@ -9322,6 +9605,8 @@ uentry_mergeDefinition (uentry old, /*@only@*/ uentry unew)
                                          fileloc_undefined);
     }
 
+  DPRINTF (("here: %s", uentry_unparseFull (old)));
+
   /*
   ** No redeclaration errors for functions here, since we
   ** don't know if this is the definition of the function.
@@ -9413,6 +9698,7 @@ uentry_mergeDefinition (uentry old, /*@only@*/ uentry unew)
       uentry_checkName (old);
     }
 
+  DPRINTF (("After: %s", uentry_unparseFull (old)));
   llassert (!ctype_isUndefined (old->utype));
 }
 
@@ -9459,27 +9745,63 @@ uentry_sameKind (uentry u1, uentry u2)
   return FALSE;
 }
    
-static void uentry_copyInto (/*@unique@*/ uentry unew, uentry old)
+static void uentry_updateInto (/*@unique@*/ uentry unew, uentry old)
 {
+  ekind okind = unew->ukind;
   llassert (uentry_isValid (unew));
   llassert (uentry_isValid (old));
 
+  DPRINTF (("Update into: %s / %s", uentry_unparseFull (unew), uentry_unparseFull (old)));
+
   unew->ukind = old->ukind;
-  unew->uname = cstring_copy (old->uname);
+  llassert (cstring_equal (unew->uname, old->uname));
   unew->utype = old->utype;
 
-  unew->whereSpecified = fileloc_copy (old->whereSpecified);
-  unew->whereDefined = fileloc_copy (old->whereDefined);
-  unew->whereDeclared = fileloc_copy (old->whereDeclared);
+  if (fileloc_isDefined (unew->whereSpecified) 
+      && !fileloc_isDefined (old->whereSpecified))
+    {
+      ; /* Keep the old value */
+    }
+  else
+    {
+      fileloc_free (unew->whereSpecified); /*@i523 why no error without this? */
+      unew->whereSpecified = fileloc_copy (old->whereSpecified);
+    }
+
+  if (fileloc_isDefined (unew->whereDefined) 
+      && !fileloc_isDefined (old->whereDefined))
+    {
+      ; /* Keep the old value */
+    }
+  else
+    {
+      fileloc_free (unew->whereDefined); /*@i523 why no error without this? */
+      unew->whereDefined = fileloc_copy (old->whereDefined);
+    }
+
+  if (fileloc_isDefined (unew->whereDeclared) 
+      && !fileloc_isDefined (old->whereDeclared))
+    {
+      ; /* Keep the old value */
+    }
+  else
+    {
+      fileloc_free (unew->whereDeclared); /*@i523 why no error without this? */
+      unew->whereDeclared = fileloc_copy (old->whereDeclared);
+    }
+
+  DPRINTF (("Update into: %s / %s", uentry_unparseFull (unew), uentry_unparseFull (old)));
 
   unew->sref = sRef_saveCopy (old->sref); /* Memory leak! */
   unew->used = old->used;
   unew->lset = FALSE;
   unew->isPrivate = old->isPrivate;
   unew->hasNameError = old->hasNameError;
-  unew->uses = filelocList_undefined;
+  unew->uses = filelocList_append (unew->uses, old->uses);
+  old->uses = filelocList_undefined;
 
   unew->storageclass = old->storageclass;
+  uinfo_free (unew->info, okind);
   unew->info = uinfo_copy (old->info, old->ukind);
 }
 
@@ -9491,7 +9813,25 @@ uentry_copy (uentry e)
     {
       uentry enew = uentry_alloc ();
       DPRINTF (("copy: %s", uentry_unparseFull (e)));
-      uentry_copyInto (enew, e);
+      enew->ukind = e->ukind;
+      enew->uname = cstring_copy (e->uname);
+      enew->utype = e->utype;
+      
+      enew->whereSpecified = fileloc_copy (e->whereSpecified);
+      enew->whereDefined = fileloc_copy (e->whereDefined);
+      enew->whereDeclared = fileloc_copy (e->whereDeclared);
+      
+      enew->sref = sRef_saveCopy (e->sref); /* Memory leak! */
+      enew->used = e->used;
+      enew->lset = FALSE;
+      enew->isPrivate = e->isPrivate;
+      enew->hasNameError = e->hasNameError;
+      enew->uses = filelocList_undefined;
+      
+      enew->storageclass = e->storageclass;
+      enew->info = uinfo_copy (e->info, e->ukind);
+      enew->warn = warnClause_copy (e->warn);
+
       DPRINTF (("Here we are..."));
       DPRINTF (("original: %s", uentry_unparseFull (e)));
       DPRINTF (("copy: %s", uentry_unparse (enew)));
@@ -9584,7 +9924,7 @@ static void
     }
 }
 
-static bool incompatibleStates (sRef rs, sRef os)
+static bool uentry_incompatibleMemoryStates (sRef rs, sRef os)
 {
   alkind rk = sRef_getAliasKind (rs);
   alkind ok = sRef_getAliasKind (os);
@@ -9663,29 +10003,32 @@ uentry_mergeAliasStates (uentry res, uentry other, fileloc loc,
                         bool mustReturn, bool flip, bool opt,
                         clause cl)    
 {
+  sRef rs = res->sref;
+  sRef os = other->sref;
+
   DPRINTF (("Merge alias states: %s / %s",
            uentry_unparseFull (res),
            uentry_unparseFull (other)));
 
-  if (sRef_isValid (res->sref))
+  if (sRef_isValid (rs))
     {
       if (!mustReturn)
        {
-         DPRINTF (("1"));
-         if (incompatibleStates (res->sref, other->sref))
+         if (uentry_incompatibleMemoryStates (rs, os))
            {
-             DPRINTF (("2"));
+             DPRINTF (("Incompatible: \n\t%s / \n\t%s",
+                       sRef_unparseFull (rs), sRef_unparseFull (os)));
 
-             if (sRef_isThroughArrayFetch (res->sref)
+             if (sRef_isThroughArrayFetch (rs)
                  && !context_getFlag (FLG_STRICTBRANCHSTATE))
                {
-                 if (sRef_isKept (res->sref) || sRef_isKept (other->sref))
+                 if (sRef_isKept (rs) || sRef_isKept (os))
                    {
-                     sRef_maybeKill (res->sref, loc);
+                     sRef_maybeKill (rs, loc);
                    }
-                 else if (sRef_isPossiblyDead (other->sref))
+                 else if (sRef_isPossiblyDead (os))
                    {
-                     sRef_maybeKill (res->sref, loc);
+                     sRef_maybeKill (rs, loc);
                    }
                  else
                    {
@@ -9694,20 +10037,19 @@ uentry_mergeAliasStates (uentry res, uentry other, fileloc loc,
                }
              else
                {
-                 if (uentry_relevantReference (other->sref, flip))
+                 if (uentry_relevantReference (os, flip))
                    {
-                     DPRINTF (("4"));
-                     if (sRef_isLocalParamVar (res->sref) 
-                         && (sRef_isLocalState (other->sref) 
-                             || sRef_isDependent (other->sref)))
+                     if (sRef_isLocalParamVar (rs) 
+                         && (sRef_isLocalState (os) 
+                             || sRef_isDependent (os)))
                        {
-                         if (sRef_isDependent (res->sref))
+                         if (sRef_isDependent (rs))
                            {
-                             sRef_setDependent (other->sref, loc);
+                             sRef_setDependent (os, loc);
                            }
                          else
                            {
-                             sRef_setDefState (res->sref, SS_UNUSEABLE, loc);
+                             sRef_setDefState (rs, SS_UNUSEABLE, loc);
                            }
                        }
                      else 
@@ -9717,33 +10059,34 @@ uentry_mergeAliasStates (uentry res, uentry other, fileloc loc,
                    }
                }
              
-             if (sRef_isKept (res->sref))
+             if (sRef_isKept (rs))
                {
-                 sRef_setKept (other->sref, loc);
+                 DPRINTF (("Setting kept: %s", sRef_unparseFull (os)));
+                 sRef_setKept (os, loc);
                }
            }
          else
            {
-             if (incompatibleStates (other->sref, res->sref))
+             if (uentry_incompatibleMemoryStates (os, rs))
                {
-                 if (uentry_relevantReference (res->sref, !flip))
+                 if (uentry_relevantReference (rs, !flip))
                    {
-                     if (sRef_isLocalParamVar (res->sref
-                         && (sRef_isDependent (res->sref)
-                             || sRef_isLocalState (res->sref)))
+                     if (sRef_isLocalParamVar (rs
+                         && (sRef_isDependent (rs)
+                             || sRef_isLocalState (rs)))
                        {
-                         if (sRef_isDependent (other->sref))
+                         if (sRef_isDependent (os))
                            {
-                             sRef_setDependent (res->sref, loc);
+                             sRef_setDependent (rs, loc);
                            }
                          else
                            {
-                             sRef_setDefState (res->sref, SS_UNUSEABLE, loc);
+                             sRef_setDefState (rs, SS_UNUSEABLE, loc);
                            }
                        }
                      else
                        {
-                         if (sRef_isParam (other->sref))
+                         if (sRef_isParam (os))
                            {
                              /* 
                              ** If the local variable associated
@@ -9755,9 +10098,9 @@ uentry_mergeAliasStates (uentry res, uentry other, fileloc loc,
                              uentry uvar = usymtab_lookupSafe (other->uname);
                              
                              if (uentry_isValid (uvar)
-                                 && ((sRef_isDead (other->sref
+                                 && ((sRef_isDead (os
                                       && sRef_isOnly (uvar->sref))
-                                     || (sRef_isDependent (other->sref)
+                                     || (sRef_isDependent (os)
                                          && sRef_isOwned (uvar->sref))))
                                {
                                  /* no error */
@@ -9781,41 +10124,51 @@ uentry_mergeAliasStates (uentry res, uentry other, fileloc loc,
                    }
                }
              
-             if (sRef_isKept (other->sref))
+             if (sRef_isKept (os))
                {
-                 sRef_setKept (res->sref, loc);
+                 sRef_setKept (rs, loc);
                }
            }
          
          if (opt)
            {
              DPRINTF (("Merge opt..."));
-             sRef_mergeOptState (res->sref, other->sref, cl, loc);
+             sRef_mergeOptState (rs, os, cl, loc);
              DPRINTF (("Done!"));
            }
          else
            {
-             sRef_mergeState (res->sref, other->sref, cl, loc);
+             DPRINTF (("Merging states: \n\t%s / \n\t%s", sRef_unparseFull (rs), sRef_unparseFull (os)));
+             sRef_mergeState (rs, os, cl, loc);
+             DPRINTF (("After merging : \n\t%s / \n\t%s", sRef_unparseFull (rs), sRef_unparseFull (os)));
            }
        }
       else
        {
-         if (sRef_isModified (other->sref))
+         if (sRef_isModified (os))
            {
-             sRef_setModified (res->sref);
+             sRef_setModified (rs);
            }
        }
     }
+
+  DPRINTF (("After merge: %s", sRef_unparseFull (res->sref)));
 }
 
 static void
-uentry_mergeValueStates (uentry res, uentry other, fileloc loc)
+uentry_mergeValueStates (uentry res, uentry other, fileloc loc, bool mustReturn, /*@unused@*/ bool flip)
 {
   valueTable rvalues;
   valueTable ovalues;
 
   DPRINTF (("Merge values: %s / %s", sRef_unparseFull (res->sref), sRef_unparseFull (other->sref)));
   
+  if (mustReturn)
+    {
+      return;
+    }
+  /* flip? */
+
   rvalues = sRef_getValueTable (res->sref);
   ovalues = sRef_getValueTable (other->sref);
   
@@ -9866,7 +10219,7 @@ uentry_mergeValueStates (uentry res, uentry other, fileloc loc)
              {
                sRef_setMetaStateValueComplete (res->sref, 
                                                fkey, stateValue_getValue (fval), 
-                                               loc);
+                                               stateValue_getLoc (fval));
                DPRINTF (("Setting res: %s", sRef_unparseFull (res->sref)));
              }
            else if (stateValue_isError (tval)
@@ -9874,6 +10227,11 @@ uentry_mergeValueStates (uentry res, uentry other, fileloc loc)
              {
                DPRINTF (("Other branch is definitely null!"));
              }
+           else if (sRef_isStateUndefined (res->sref)
+                    || sRef_isDead (res->sref))
+             {
+               ; /* Combination state doesn't matter if it is undefined or dead */
+             }
            else 
              {
                DPRINTF (("Check: %s / %s / %s / %s", fkey,
@@ -9899,7 +10257,7 @@ uentry_mergeValueStates (uentry res, uentry other, fileloc loc)
                DPRINTF (("nval: %d / %d / %d", nval,
                          stateValue_getValue (fval), stateValue_getValue (tval)));
 
-               if (cstring_isDefined (msg)) 
+               if (nval == stateValue_error)
                  {
                    /*@i32 print extra info for assignments@*/
 
@@ -9908,10 +10266,11 @@ uentry_mergeValueStates (uentry res, uentry other, fileloc loc)
                        if (optgenerror 
                            (FLG_STATEMERGE,
                             message
-                            ("Control branches merge with incompatible global states (%s and %s): %s",
+                            ("Control branches merge with incompatible global states (%s and %s)%q",
                              metaStateInfo_unparseValue (minfo, stateValue_getValue (fval)),
                              metaStateInfo_unparseValue (minfo, stateValue_getValue (tval)),
-                             msg),
+                             cstring_isDefined (msg) 
+                             ? message (": %s", msg) : cstring_undefined),
                             loc))
                          {
                            sRef_showMetaStateInfo (res->sref, fkey);
@@ -9923,11 +10282,12 @@ uentry_mergeValueStates (uentry res, uentry other, fileloc loc)
                        if (optgenerror 
                            (FLG_STATEMERGE,
                             message
-                            ("Control branches merge with incompatible states for %q (%s and %s): %s",
+                            ("Control branches merge with incompatible states for %q (%s and %s)%q",
                              uentry_getName (res),
                              metaStateInfo_unparseValue (minfo, stateValue_getValue (fval)),
                              metaStateInfo_unparseValue (minfo, stateValue_getValue (tval)),
-                             msg),
+                             cstring_isDefined (msg) 
+                             ? message (": %s", msg) : cstring_undefined),
                             loc))
                          {
                            sRef_showMetaStateInfo (res->sref, fkey);
@@ -10053,7 +10413,7 @@ uentry_mergeState (uentry res, uentry other, fileloc loc,
            uentry_unparseFull (other)));
   
   uentry_mergeAliasStates (res, other, loc, mustReturn, flip, opt, cl);
-  uentry_mergeValueStates (res, other, loc);
+  uentry_mergeValueStates (res, other, loc, mustReturn, flip);
   uentry_mergeSetStates (res, other, loc, flip, cl);
 }
 
@@ -10193,6 +10553,10 @@ bool uentry_isReturned (uentry u)
       DPRINTF (("ensures clause: %s / %s", uentry_unparse (u), 
                stateClauseList_unparse (clauses)));
 
+      /*
+      ** This should be in exprNode_reflectEnsuresClause
+      */
+
       stateClauseList_postElements (clauses, cl)
        {
          if (!stateClause_isGlobal (cl))
@@ -10219,7 +10583,7 @@ bool uentry_isReturned (uentry u)
                } end_sRefSet_elements ;
            }
        } end_stateClauseList_postElements ;
-
+       
       return res;
     }
   else
@@ -10602,13 +10966,15 @@ void uentry_checkName (uentry ue)
     }
 }
 
-/*@exposed@*/ uentry uentry_makeUnrecognized (cstring c, /*@keep@*/ fileloc loc)
+/*@exposed@*/ uentry uentry_makeUnrecognized (cstring c, /*@only@*/ fileloc loc)
 {
   uentry ue;
   fileloc tloc;
 
   /*
-  ** Can't but unrecognized ids in macros in global scope, because srefs will break! */
+  ** Can't but unrecognized ids in macros in global scope, because srefs will break! 
+  */
+
   if (!context_inMacro ())
     {
       sRef_setGlobalScopeSafe ();
@@ -10667,60 +11033,8 @@ bool uentry_isGlobalMarker (uentry ue)
          && (cstring_equal (uentry_rawName (ue), GLOBAL_MARKER_NAME)));
 }
 
-
-//
 /* new start modifications */
 
-/*@ignore@*/
-
-
-
-  
-static  void uentry_testInRange (uentry p_e, uentry cconstant)  {
-  if( uentry_isValid(p_e) ) {
-    if( sRef_isValid (p_e->sref) ) {
-      char * t = cstring_toCharsSafe (uentry_unparse(cconstant) );
-      int index = atoi( t );
-      free (t);
-      //      usymtab_testInRange (p_e->sref, index);
-    }//end if
-  }//endif
-}
-
-
-/*  void uentry_setStringLength (uentry p_e, uentry cconstant)  { */
-/*  if( uentry_isValid(p_e) ) { */
-/*    if( p_e->info != NULL) { */
-/*      if( p_e->info->var != NULL) { */
-/*        char *t =  cstring_toCharsSafe (uentry_unparse(cconstant)); */
-/*        int length = atoi( t ); */
-/*        free (t); */
-/*        p_e->info->var->bufinfo->len = length;  */
-/*        p_e->sref->bufinfo.len = length; */
-/*        printf("Set string length of buff to %d \n",  p_e->sref->bufinfo.size); */
-/*      }//end if */
-/*    }//endif */
-/*  }//end if */
-/*  } */
-
-
-static void uentry_setBufferSize (uentry p_e, exprNode cconstant) {
-if( uentry_isValid(p_e) ) {
-  if( p_e->info != NULL) {
-    if( p_e->info->var != NULL) {
-      int size = atoi(cstring_toCharsSafe(exprNode_unparse(cconstant) ) ); 
-      p_e->info->var->bufinfo->size = size; 
-      p_e->sref->bufinfo.size = size;
-      printf("Set buffer size to %d \n",  p_e->sref->bufinfo.size);
-      //  fprintf(stderr, "For %s and %s\n", uentry_unparse(p_e) );
-      // fprintf(stderr, "and %d\n", size );
-      
-    }//end if
-  }//endif
-}//end if
-}
-
-  
 /* start modifications */
 /*
 requires: p_e is defined, is a ptr/array variable 
@@ -10730,15 +11044,17 @@ effects: sets the state of the variable
 
 
 void uentry_setPossiblyNullTerminatedState (uentry p_e)  {
+  /*@access sRef@*/ /*i523 shouldn't do this! */
   if( uentry_isValid(p_e) ) {
     if( p_e->info != NULL) {
       if( p_e->info->var != NULL) {
          p_e->info->var->bufinfo->bufstate = BB_POSSIBLYNULLTERMINATED;
          p_e->sref->bufinfo.bufstate = BB_POSSIBLYNULLTERMINATED;
          return;
-      }/* End if */
-    }/* End if */
-  }/* End if */
+      }
+    }
+  }
+  /*@noaccess sRef@*/
 
   fprintf(stderr, "uentry:Error in setPossiblyNullTerminatedState\n");
 }
@@ -10754,37 +11070,17 @@ void uentry_setNullTerminatedState (uentry p_e)  {
     if( p_e->info != NULL) {
       if( p_e->info->var != NULL) {
         p_e->info->var->bufinfo->bufstate = BB_NULLTERMINATED;
+       /*@access sRef@*/ /*@i523 bad!*/
         p_e->sref->bufinfo.bufstate = BB_NULLTERMINATED;
+       /*@noaccess sRef@*/ 
         return;
-      }//End if
-    }//End if
-  }//End if
+      }
+    }
+  }
 
   fprintf(stderr, "uentry:Error in setNullTerminatedState\n");
 }
 
-
-/*
-requires: p_e is defined, is a ptr/array variable 
-modifies: p_e
-effects: sets the state of the variable
-*/
-
-/*  void uentry_setNotNullTerminatedState (uentry p_e)  { */
-/*    if( uentry_isValid(p_e) ) { */
-/*      if( p_e->info != NULL) { */
-/*        if( p_e->info->var != NULL) { */
-/*          p_e->info->var->bufinfo->bufstate = BB_NOTNULLTERMINATED; */
-/*          p_e->sref->bufinfo.bufstate = BB_NOTNULLTERMINATED; */
-/*          return; */
-/*        }//End if */
-/*      }//End if */
-/*    }//End if */
-
-/*    fprintf(stderr, "uentry:Error in setNotNullTerminatedState\n"); */
-/*  } */
-
-
 /*
 requires: p_e is defined, is a ptr/array variable 
 modifies: p_e
@@ -10796,11 +11092,13 @@ void uentry_setSize (uentry p_e, int size)  {
     if( p_e->info != NULL) {
       if( p_e->info->var != NULL) {
         p_e->info->var->bufinfo->size = size;
+       /*@access sRef@*/ /*@i523 bad!*/
         p_e->sref->bufinfo.size = size;
+       /*@noaccess sRef@*/
         return;
-      }//End if
-    }//End if
-  }//End if
+      }
+    }
+  }
 
   fprintf(stderr, "uentry:Error in setSize\n");
 }
@@ -10812,18 +11110,38 @@ modifies: p_e
 effects: sets the length of the buffer
 */
 
- void uentry_setLen (uentry p_e, int len)  {
+void uentry_setLen (uentry p_e, int len)  {
   if( uentry_isValid(p_e) ) {
     if( p_e->info != NULL) {
       if( p_e->info->var != NULL) {
         p_e->info->var->bufinfo->len = len;
+       /*@access sRef@*/ /*@i523 bad!*/
         p_e->sref->bufinfo.len = len;
+       /*@noaccess sRef@*/
         return;
-      }//End if
-    }//End if
-  }//End if
-
+      }
+    }
+  }
+  
   fprintf(stderr, "uentry:Error in setLen\n");
 }
-/*@end@*/
+
 /*@=type*/
+
+bool uentry_hasMetaStateEnsures (uentry e)
+{
+  if (uentry_isValid (e) && uentry_isFunction (e))
+    {
+      return functionConstraint_hasMetaStateConstraint (e->info->fcn->postconditions);
+    }
+  else
+    {
+      return FALSE;
+    }
+}
+
+metaStateConstraintList uentry_getMetaStateEnsures (uentry e)
+{
+  llassert (uentry_isValid (e) && uentry_isFunction (e));
+  return functionConstraint_getMetaStateConstraints (e->info->fcn->postconditions);
+}
This page took 0.128221 seconds and 4 git commands to generate.