]> andersk Git - splint.git/blobdiff - src/sRef.c
Fixes for win32
[splint.git] / src / sRef.c
index 030e5c223e1e6ba85d7f824632dba86899c863e9..b7504360ab463c4a74d77cc54d45f0d178e08804 100644 (file)
@@ -1,6 +1,6 @@
 /*
 ** Splint - annotation-assisted static program checker
-** Copyright (C) 1994-2002 University of Virginia,
+** Copyright (C) 1994-2003 University of Virginia,
 **         Massachusetts Institute of Technology
 **
 ** This program is free software; you can redistribute it and/or modify it
@@ -189,7 +189,8 @@ static void sinfo_free (/*@special@*/ /*@temp@*/ /*@notnull@*/ sRef p_s)
 static /*@null@*/ sinfo sinfo_copy (/*@notnull@*/ sRef p_s) /*@*/ ;
 static void sRef_setPartsFromUentry (sRef p_s, uentry p_ue)
    /*@modifies p_s@*/ ;
-static bool checkDeadState (/*@notnull@*/ sRef p_el, bool p_tbranch, fileloc p_loc);
+static bool checkDeadState (/*@notnull@*/ sRef p_el, /*@null@*/ sRef p_e2, 
+                           bool p_tbranch, fileloc p_loc);
 static /*@dependent@*/ sRef sRef_constructPointerAux (/*@notnull@*/ /*@exposed@*/ sRef p_t) /*@*/ ;
 
 static void 
@@ -342,7 +343,7 @@ static void sRef_checkValidAux (sRef s, sRefSet checkedsofar)
 
     case SK_PARAM:
       llassert (s->info->paramno >= -1);
-      llassert (s->info->paramno <= 50); /*@i32 bogus...*/
+      llassert (s->info->paramno <= 999); /* sanity check */
       break;
 
     case SK_ARRAYFETCH:
@@ -437,8 +438,8 @@ static /*@dependent@*/ /*@notnull@*/ /*@special@*/ sRef
 
   /* start modifications */
   s->bufinfo.bufstate = BB_NOTNULLTERMINATED;
-  s->bufinfo.size = -1; /*@i24 unknown@*/
-  s->bufinfo.len = -1; /*@i24 unknown@*/
+  s->bufinfo.size = -1; 
+  s->bufinfo.len = -1; 
   /* end modifications */
 
   s->aliaskind = AK_UNKNOWN;
@@ -655,22 +656,19 @@ static void sRef_setTypeState (sRef s)
     }
 }
 
-static bool
-  sRef_hasAliasInfoLoc (sRef s)
+bool sRef_hasAliasInfoLoc (sRef s)
 {
   return (sRef_isReasonable (s) && (s->aliasinfo != NULL)
          && (fileloc_isDefined (s->aliasinfo->loc)));
 }
 
-static /*@falsewhennull@*/ bool
-sRef_hasStateInfoLoc (sRef s)
+/*@falsewhennull@*/ bool sRef_hasStateInfoLoc (sRef s)
 {
   return (sRef_isReasonable (s) && (s->definfo != NULL) 
          && (fileloc_isDefined (s->definfo->loc)));
 }
 
-static /*@falsewhennull@*/ bool
-sRef_hasExpInfoLoc (sRef s)
+/*@falsewhennull@*/ bool sRef_hasExpInfoLoc (sRef s)
 {
   return (sRef_isReasonable (s) 
          && (s->expinfo != NULL) && (fileloc_isDefined (s->expinfo->loc)));
@@ -892,7 +890,7 @@ sRef_getBaseUentry (sRef s)
       switch (base->kind)
        {
        case SK_PARAM:
-         res = usymtab_getRefQuiet (paramsScope, base->info->paramno);
+         res = usymtab_getRefQuiet (paramsScope, usymId_fromInt (base->info->paramno));
          break;
 
        case SK_CVAR:
@@ -1055,7 +1053,7 @@ sRef_getUentry (sRef s)
   switch (s->kind)
     {
     case SK_PARAM:
-      return (usymtab_getRefQuiet (paramsScope, s->info->paramno));
+      return (usymtab_getRefQuiet (paramsScope, usymId_fromInt (s->info->paramno)));
     case SK_CVAR:
       return (usymtab_getRefQuiet (s->info->cvar->lexlevel, s->info->cvar->index));
     case SK_CONJ:
@@ -1070,6 +1068,7 @@ sRef_getUentry (sRef s)
            return sRef_getUentry (s->info->conj->b);
          }
       }
+    case SK_FIELD: /* evans 2002-07-17: added case for SK_FIELD */
     case SK_UNKNOWN:
     case SK_SPECIAL:
       return uentry_undefined;
@@ -2257,7 +2256,6 @@ sRef_closeEnough (sRef s1, sRef s2)
     {
     case SK_RESULT:
       {
-       /* s = sRef_saveCopy(s); */ /*@i523@*/
        ce = constraintExpr_makeTermsRef (s);
        return ce;
       }
@@ -2274,7 +2272,6 @@ sRef_closeEnough (sRef s1, sRef s2)
       {
        sRef temp;
        temp = (sRef_makePointer (sRef_fixBaseParam (s->info->ref, args)));
-       /* temp = sRef_saveCopy(temp); */ /*@i523@*/
        ce = constraintExpr_makeTermsRef (temp);
        return ce;
       }
@@ -2298,14 +2295,15 @@ sRef_closeEnough (sRef s1, sRef s2)
        return ce;
       }
     case SK_PARAM:
-      llassert(exprNodeList_size (args) > s->info->paramno);
-       {
-         exprNode e = exprNodeList_nth (args, s->info->paramno);
-
-         llassert( !(exprNode_isError (e)) );
-         ce = constraintExpr_makeExprNode (e);
-         return ce;
-       }
+      {
+       exprNode e;
+       llassert (exprNodeList_size (args) > s->info->paramno);
+       e = exprNodeList_nth (args, s->info->paramno);
+       
+       llassert (!(exprNode_isError (e)));
+       ce = constraintExpr_makeExprNode (e);
+       return ce;
+      }
 
     default:
       {
@@ -2458,9 +2456,11 @@ static /*@exposed@*/ sRef sRef_undumpBody (char **c)
   switch (p)
     {
     case 'g':
-      return (sRef_makeGlobal (usymId_fromInt (reader_getInt (c)), ctype_unknown, stateInfo_currentLoc ()));
+      return (sRef_makeGlobal (usymId_fromInt (reader_getInt (c)), 
+                              ctype_unknown, stateInfo_currentLoc ()));
     case 'p':
-      return (sRef_makeParam (reader_getInt (c), ctype_unknown, stateInfo_makeLoc (g_currentloc)));
+      return (sRef_makeParam (reader_getInt (c), ctype_unknown, 
+                             stateInfo_makeLoc (g_currentloc, SA_DECLARED)));
     case 'r':
       return (sRef_makeResult (ctype_undump (c)));
     case 'a':
@@ -3177,7 +3177,7 @@ sRef_unparseNoArgs (sRef s)
 
   s->kind = SK_UNCONSTRAINED;
   s->info = (sinfo) dmalloc (sizeof (*s->info));
-  s->info->fname = fname;
+  s->info->fname = cstring_copy (fname); /* evans 2002-07-12: this was exposed, causing memory errors */
 
   return (s);
 }
@@ -3359,7 +3359,7 @@ static bool sRef_isZerothArrayFetch (/*@notnull@*/ sRef s)
       s->kind = SK_ADR;
       s->type = ctype_makePointer (t->type);
       s->info = (sinfo) dmalloc (sizeof (*s->info));
-      s->info->ref = t; /* sRef_copy (t);  */ /*@i32@*/
+      s->info->ref = t; 
       
       if (t->defstate == SS_UNDEFINED) 
        /* no! it is allocated even still: && !ctype_isPointer (t->type)) */
@@ -3380,7 +3380,8 @@ static bool sRef_isZerothArrayFetch (/*@notnull@*/ sRef s)
        }
 
       llassert (valueTable_isUndefined (s->state));
-      s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc));
+      s->state = context_createValueTable (s, 
+                                          stateInfo_makeLoc (g_currentloc, SA_CREATED));
       return s;
     }
 }
@@ -3547,13 +3548,13 @@ static int sRef_depth (sRef s)
 sRef
 sRef_makeObject (ctype o)
 {
-  sRef s = sRef_newRef (); /*@i423 same line is bad...@*/
+  sRef s = sRef_newRef (); 
 
   s->kind = SK_OBJECT;
   s->info = (sinfo) dmalloc (sizeof (*s->info));
   s->info->object = o;
   llassert (valueTable_isUndefined (s->state));
-  s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc));
+  s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc, SA_CREATED));
   return s;
 }
 
@@ -3570,9 +3571,9 @@ sRef sRef_makeExternal (sRef t)
   s->kind = SK_EXTERNAL;
   s->info = (sinfo) dmalloc (sizeof (*s->info));
   s->type = t->type;
-  s->info->ref = t; /* sRef_copy (t); */ /*@i32 was exposed@*/
+  s->info->ref = t;
   llassert (valueTable_isUndefined (s->state));
-  s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc));
+  s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc, SA_DECLARED));
   return s;
 }
 
@@ -3584,11 +3585,11 @@ sRef sRef_makeExternal (sRef t)
       
       s->kind = SK_DERIVED;
       s->info = (sinfo) dmalloc (sizeof (*s->info));
-      s->info->ref = t; /* sRef_copy (t); */ /*@i32@*/ 
+      s->info->ref = t;
       
       s->type = t->type;
       llassert (valueTable_isUndefined (s->state));
-      s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc));
+      s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc, SA_CREATED));
       return s;
     }
   else
@@ -3726,6 +3727,7 @@ sRef_mergeStateQuietReverse (/*@dependent@*/ sRef res, /*@dependent@*/ sRef othe
       if (other->defstate != SS_UNKNOWN)
        {
          res->defstate = other->defstate;
+         res->definfo = stateInfo_update (res->definfo, other->definfo);
        }
     }
 
@@ -3739,7 +3741,8 @@ sRef_mergeStateQuietReverse (/*@dependent@*/ sRef res, /*@dependent@*/ sRef othe
     }
   else
     {
-      if (sRef_getNullState (other) != NS_UNKNOWN && sRef_getNullState (other) != sRef_getNullState (res))
+      if (sRef_getNullState (other) != NS_UNKNOWN 
+         && sRef_getNullState (other) != sRef_getNullState (res))
        {
          changed = TRUE;
          sRef_updateNullState (res, other);
@@ -3861,6 +3864,7 @@ sRef_mergeStateAux (/*@notnull@*/ sRef res, /*@notnull@*/ sRef other,
              res->defstate = SS_DEAD;
            }
          
+         res->definfo = stateInfo_update (res->definfo, other->definfo);
          sRef_clearDerived (other);
          sRef_clearDerived (res);
        }
@@ -4039,8 +4043,6 @@ sRef_mergeStateAux (/*@notnull@*/ sRef res, /*@notnull@*/ sRef other,
   ** Merge value table states
   */
 
-
-  /*@i3245@*/
 # if 0
   /*
   ** This doesn't do anything.  And its broken too...
@@ -4127,13 +4129,16 @@ sRef_mergeDerivs (/*@only@*/ sRefSet res, sRefSet other,
                       el->defstate == SS_PDEFINED)
                {
                  el->defstate = SS_ALLOCATED;
+                 el->definfo = stateInfo_update (el->definfo, e2->definfo);
                  sRef_clearDerived (el);
                }
              else if ((el->defstate == SS_DEAD || sRef_isKept (el)) &&
                       (e2->defstate == SS_DEFINED && !sRef_isKept (e2)))
                {
-                 
-                 if (checkDeadState (el, TRUE, loc))
+                 DPRINTF (("Checking dead: %s / %s", sRef_unparseFull (el),
+                           sRef_unparseFull (e2)));
+
+                 if (checkDeadState (el, e2, TRUE, loc))
                    {
                      if (sRef_isThroughArrayFetch (el))
                        {
@@ -4145,8 +4150,10 @@ sRef_mergeDerivs (/*@only@*/ sRefSet res, sRefSet other,
              else if ((e2->defstate == SS_DEAD || sRef_isKept (e2)) &&
                       (el->defstate == SS_DEFINED && !sRef_isKept (el)))
                {
-                 
-                 if (checkDeadState (e2, FALSE, loc))
+                 DPRINTF (("Checking dead: %s / %s", sRef_unparseFull (el),
+                           sRef_unparseFull (e2)));
+
+                 if (checkDeadState (e2, el, FALSE, loc))
                    {
                      if (sRef_isThroughArrayFetch (el))
                        {
@@ -4160,12 +4167,14 @@ sRef_mergeDerivs (/*@only@*/ sRefSet res, sRefSet other,
                {
                  DPRINTF (("set pdefined: %s", sRef_unparseFull (el)));
                  el->defstate = SS_PDEFINED;
+                 el->definfo = stateInfo_update (el->definfo, e2->definfo);
                }
              else if (e2->defstate == SS_DEFINED &&
                       el->defstate == SS_PDEFINED)
                {
                  DPRINTF (("set pdefined: %s", sRef_unparseFull (e2)));
                  e2->defstate = SS_PDEFINED;
+                 e2->definfo = stateInfo_update (e2->definfo, el->definfo);
                }
              else
                {
@@ -4204,7 +4213,8 @@ sRef_mergeDerivs (/*@only@*/ sRefSet res, sRefSet other,
            }
          else /* not defined */
            {
-             (void) checkDeadState (el, TRUE, loc);
+             DPRINTF (("Checking dead: %s", sRef_unparseFull (el)));
+             (void) checkDeadState (el, e2, TRUE, loc);
            }
        }
     } end_sRefSet_allElements;
@@ -4213,7 +4223,8 @@ sRef_mergeDerivs (/*@only@*/ sRefSet res, sRefSet other,
     {
       if (sRef_isReasonable (el))
        {
-         (void) checkDeadState (el, FALSE, loc);
+         DPRINTF (("Checking dead: %s", sRef_unparseFull (el)));
+         (void) checkDeadState (el, sRef_undefined, FALSE, loc);
        }
     } end_sRefSet_allElements;
     
@@ -4225,7 +4236,7 @@ sRef_mergeDerivs (/*@only@*/ sRefSet res, sRefSet other,
 ** Returns TRUE is there is an error.
 */
 
-static bool checkDeadState (/*@notnull@*/ sRef el, bool tbranch, fileloc loc)
+static bool checkDeadState (/*@notnull@*/ sRef el, sRef e2, bool tbranch, fileloc loc)
 {
   /*
   ** usymtab_isGuarded --- the utab should still be in the
@@ -4242,7 +4253,8 @@ static bool checkDeadState (/*@notnull@*/ sRef el, bool tbranch, fileloc loc)
 
   
   if ((sRef_isDead (el) || sRef_isKept (el))
-      && !sRef_isDeepUnionField (el) && !sRef_isThroughArrayFetch (el))
+      && !sRef_isDeepUnionField (el) 
+      && !sRef_isThroughArrayFetch (el))
     {
        
       if (!tbranch)
@@ -4277,10 +4289,21 @@ static bool checkDeadState (/*@notnull@*/ sRef el, bool tbranch, fileloc loc)
              sRef_showStateInfo (el);
            }
 
+         if (sRef_isValid (e2))
+           {
+             if (sRef_isKept (e2))
+               {
+                 sRef_showAliasInfo (e2);      
+               }
+             else
+               {
+                 sRef_showStateInfo (e2);
+               }
+           }
+
          /* prevent further errors */
          el->defstate = SS_UNKNOWN; 
-         sRef_setAliasKind (el, AK_ERROR, fileloc_undefined);
-         
+         sRef_setAliasKind (el, AK_ERROR, fileloc_undefined);    
          return FALSE;
        }
     }
@@ -4291,14 +4314,13 @@ static bool checkDeadState (/*@notnull@*/ sRef el, bool tbranch, fileloc loc)
 static void 
 checkDerivDeadState (/*@notnull@*/ sRef el, bool tbranch, fileloc loc)
 {
-  
-  if (checkDeadState (el, tbranch, loc))
+  if (checkDeadState (el, sRef_undefined, tbranch, loc))
     {
       sRefSet_allElements (el->deriv, t)
        {
          if (sRef_isReasonable (t))
            {
-                     checkDerivDeadState (t, tbranch, loc);
+             checkDerivDeadState (t, tbranch, loc);
            }
        } end_sRefSet_allElements;
     }
@@ -4341,7 +4363,7 @@ static sRefSet
            {
              if (!opt)
                {
-                                 checkDerivDeadState (el, (cl == FALSECLAUSE), loc);
+                 checkDerivDeadState (el, (cl == FALSECLAUSE), loc);
                }
 
              ret = sRefSet_insert (ret, el);
@@ -4384,8 +4406,8 @@ sRef sRef_makeConj (/*@exposed@*/ /*@returned@*/ sRef a, /*@exposed@*/ sRef b)
       s->kind = SK_CONJ;
       s->info = (sinfo) dmalloc (sizeof (*s->info));
       s->info->conj = (cjinfo) dmalloc (sizeof (*s->info->conj));
-      s->info->conj->a = a; /* sRef_copy (a) */ /*@i32*/ ;
-      s->info->conj->b = b; /* sRef_copy (b);*/ /*@i32@*/ ;
+      s->info->conj->a = a;
+      s->info->conj->b = b;
       
       if (ctype_equal (a->type, b->type)) s->type = a->type;
       else s->type = ctype_makeConj (a->type, b->type);
@@ -4393,6 +4415,8 @@ sRef sRef_makeConj (/*@exposed@*/ /*@returned@*/ sRef a, /*@exposed@*/ sRef b)
       if (a->defstate == b->defstate)
        {
          s->defstate = a->defstate;
+         s->definfo = stateInfo_update (s->definfo, a->definfo);
+         s->definfo = stateInfo_update (s->definfo, b->definfo);
        }
       else
        {
@@ -4405,7 +4429,7 @@ sRef sRef_makeConj (/*@exposed@*/ /*@returned@*/ sRef a, /*@exposed@*/ sRef b)
       s->aliaskind = alkind_resolve (a->aliaskind, b->aliaskind);
 
       llassert (valueTable_isUndefined (s->state));
-      s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc));
+      s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc, SA_MERGED));
       return s;
     }
   else
@@ -4505,7 +4529,7 @@ sRef_makeResult (ctype c)
   s->aliaskind = AK_UNKNOWN;
   sRef_setNullStateN (s, NS_UNKNOWN);
   llassert (valueTable_isUndefined (s->state));
-  s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc));
+  s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc, SA_DECLARED));
 
   DPRINTF (("Result: [%p] %s", s, sRef_unparseFull (s)));
   return s;
@@ -4590,10 +4614,11 @@ sRef_makeUnsafe (sRef s)
 {
   if (sRef_isInvalid (s)) return (cstring_undefined);
 
-  return (message ("[%p] %q - %q [%s] { %q } < %q >", 
+  return (message ("[%p] %q - %q { %q } [%s] { %q } < %q >", 
                   s,
                   sRef_unparseDebug (s), 
                   sRef_unparseState (s),
+                  stateInfo_unparse (s->definfo),
                   exkind_unparse (s->oexpkind),
                   sRefSet_unparseDebug (s->deriv),
                   valueTable_unparse (s->state)));
@@ -4982,7 +5007,7 @@ void sRef_setAliasKind (sRef s, alkind kind, fileloc loc)
       if ((kind != s->aliaskind && kind != s->oaliaskind)
          && fileloc_isDefined (loc))
        {
-         s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, loc);
+         s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, stateAction_fromAlkind (kind), loc);
        }
       
       s->aliaskind = kind;
@@ -5054,7 +5079,7 @@ void sRef_setExKind (sRef s, exkind exp, fileloc loc)
     {
       if (s->expkind != exp)
        {
-         s->expinfo = stateInfo_updateLoc (s->expinfo, loc);
+         s->expinfo = stateInfo_updateLoc (s->expinfo, stateAction_fromExkind (exp), loc);
        }
       
       s->expkind = exp;
@@ -5114,11 +5139,7 @@ void sRef_setUndefined (sRef s, fileloc loc)
   if (sRef_isReasonable (s))
     {
       s->defstate = SS_UNDEFINED;
-
-      if (fileloc_isDefined (loc))
-       {
-         s->definfo = stateInfo_updateLoc (s->definfo, loc);
-       }
+      s->definfo = stateInfo_updateLoc (s->definfo, SA_UNDEFINED, loc);
 
       sRef_clearDerived (s);
     }
@@ -5131,11 +5152,7 @@ static void sRef_setDefinedAux (sRef s, fileloc loc, bool clear)
 
   DPRINTF (("Set defined: %s", sRef_unparseFull (s)));
 
-  if (s->defstate != SS_DEFINED && fileloc_isDefined (loc))
-    {
-      s->definfo = stateInfo_updateLoc (s->definfo, loc);
-    }
-  
+  s->definfo = stateInfo_updateLoc (s->definfo, SA_DEFINED, loc);  
   s->defstate = SS_DEFINED;
   
   DPRINTF (("Set defined: %s", sRef_unparseFull (s)));
@@ -5235,7 +5252,7 @@ static void sRef_setDefinedAux (sRef s, fileloc loc, bool clear)
          el->defstate = SS_DEFINED;
        } end_sRefSet_elements ;
     }
-
+  
   DPRINTF (("Set defined: %s", sRef_unparseFull (s)));
 }
 
@@ -5340,12 +5357,7 @@ void sRef_setPdefined (sRef s, fileloc loc)
          return;
        }
       
-      if (s->defstate != SS_PDEFINED && fileloc_isDefined (loc))
-       {
-         s->definfo = stateInfo_updateLoc (s->definfo, loc);
-       }
-
-      DPRINTF (("set pdefined: %s", sRef_unparseFull (s)));
+      s->definfo = stateInfo_updateLoc (s->definfo, SA_PDEFINED, loc);
       s->defstate = SS_PDEFINED;
       
       /* e.g., if x is allocated, *x = 3 defines x */
@@ -5373,13 +5385,16 @@ static void sRef_setStateAux (sRef s, sstate ss, fileloc loc)
 {
   sRef_checkMutable (s);
 
+  DPRINTF (("Set state: %s => %s", sRef_unparseFull (s), sstate_unparse (ss)));
+
   if (sRef_isReasonable (s))
     {
       /* if (s->defstate == SS_RELDEF) return; */
 
       if (s->defstate != ss && fileloc_isDefined (loc))
        {
-         s->definfo = stateInfo_updateLoc (s->definfo, loc);
+         s->definfo = stateInfo_updateLoc (s->definfo, 
+                                           stateAction_fromSState (ss), loc);
        }
 
       s->defstate = ss;
@@ -5423,11 +5438,7 @@ static void sRef_setAllocatedShallow (sRef s, fileloc loc)
       if (s->defstate == SS_DEAD || s->defstate == SS_UNDEFINED)
        {
          s->defstate = SS_ALLOCATED;
-         
-         if (fileloc_isDefined (loc))
-           {
-             s->definfo = stateInfo_updateLoc (s->definfo, loc);
-           }
+         s->definfo = stateInfo_updateLoc (s->definfo, SA_ALLOCATED, loc);
        }
     }
 }
@@ -5457,7 +5468,7 @@ void sRef_setShared (sRef s, fileloc loc)
     {
       if (s->aliaskind != AK_SHARED && fileloc_isDefined (loc))
        {
-         s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, loc);
+         s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, SA_SHARED, loc);
        }
 
       s->aliaskind = AK_SHARED;
@@ -5472,7 +5483,7 @@ void sRef_setLastReference (sRef s, /*@exposed@*/ sRef ref, fileloc loc)
   if (sRef_isReasonable (s))
     {
       s->aliaskind = sRef_getAliasKind (ref);
-      s->aliasinfo = stateInfo_updateRefLoc (s->aliasinfo, ref, loc);
+      s->aliasinfo = stateInfo_updateRefLoc (s->aliasinfo, ref, stateAction_fromAlkind (s->aliaskind), loc);
     }
 }
 
@@ -5485,7 +5496,7 @@ void sRef_setNullStateAux (/*@notnull@*/ sRef s, nstate ns, fileloc loc)
 
   if (fileloc_isDefined (loc))
     {
-      s->nullinfo = stateInfo_updateLoc (s->nullinfo, loc);
+      s->nullinfo = stateInfo_updateLoc (s->nullinfo, stateAction_fromNState (ns), loc);
     }
 }
 
@@ -5621,7 +5632,7 @@ void sRef_setOnly (sRef s, fileloc loc)
     {
       sRef_checkMutable (s);
       s->aliaskind = AK_ONLY;
-      s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, loc);
+      s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, SA_ONLY, loc);
     }
 }
 
@@ -5632,7 +5643,7 @@ void sRef_setDependent (sRef s, fileloc loc)
       sRef_checkMutable (s);
       DPRINTF (("Setting dependent: %s", sRef_unparseFull (s)));
       s->aliaskind = AK_DEPENDENT;
-      s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, loc);
+      s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, SA_DEPENDENT, loc);
     }
 }
 
@@ -5642,7 +5653,7 @@ void sRef_setOwned (sRef s, fileloc loc)
     {
       sRef_checkMutable (s);
       s->aliaskind = AK_OWNED;
-      s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, loc);
+      s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, SA_OWNED, loc);
     }
 }
 
@@ -5668,7 +5679,7 @@ void sRef_setKept (sRef s, fileloc loc)
 
       sRef_checkMutable (s);
       s->aliaskind = AK_KEPT;
-      s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, loc);
+      s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, SA_KEPT, loc);
     }
 }
 
@@ -5704,7 +5715,8 @@ void sRef_setFresh (sRef s, fileloc loc)
     {
       sRef_checkMutable (s);
       s->aliaskind = AK_FRESH;
-      s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, loc);
+      s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, SA_CREATED, loc);
+      DPRINTF (("SetFresh: %s", sRef_unparseFull (s)));
     }
 }
 
@@ -5733,8 +5745,8 @@ void sRef_kill (sRef s, fileloc loc)
       
       s->aliaskind = s->oaliaskind;
       s->defstate = SS_DEAD;
-      s->definfo = stateInfo_updateLoc (s->definfo, loc);
-
+      s->definfo = stateInfo_updateLoc (s->definfo, SA_KILLED, loc);
+      DPRINTF (("State info: %s", stateInfo_unparse (s->definfo)));
       sRef_clearDerived (s);
     }
 }
@@ -5763,7 +5775,9 @@ void sRef_maybeKill (sRef s, fileloc loc)
       
       s->aliaskind = s->oaliaskind;
       s->defstate = SS_HOFFA; 
-      s->definfo = stateInfo_updateLoc (s->definfo, loc);
+      s->definfo = stateInfo_updateLoc (s->definfo, SA_PKILLED, loc);
+      DPRINTF (("State info: %s / %s", sRef_unparse (s), 
+               stateInfo_unparse (s->definfo)));
       sRef_clearDerived (s); 
     }
 
@@ -5882,7 +5896,7 @@ sRef sRef_copy (sRef s)
 
       t->deriv = sRefSet_newDeepCopy (s->deriv);
       t->state = valueTable_copy (s->state);
-
+      
       DPRINTF (("Made copy: %s => %s", sRef_unparseFull (s), sRef_unparseFull (t)));
       return t;
     }
@@ -6014,7 +6028,7 @@ bool sRef_isDirectParam (sRef s)
   return ((s->kind == SK_CVAR) &&
          (s->info->cvar->lexlevel == functionScope) &&
          (context_inFunction () && 
-          (s->info->cvar->index <= uentryList_size (context_getParams ()))));
+          (s->info->cvar->index <= usymId_fromInt (uentryList_size (context_getParams ())))));
 }
 
 bool sRef_isPointer (sRef s)
@@ -6077,6 +6091,8 @@ void sRef_free (/*@only@*/ sRef s)
       DPRINTF (("Free sref: [%p]", s));
 
       sRef_checkValid (s);
+      
+      multiVal_free (s->val); /* evans 2002-07-12 */
 
       stateInfo_free (s->expinfo);
       stateInfo_free (s->aliasinfo);
@@ -6086,7 +6102,7 @@ void sRef_free (/*@only@*/ sRef s)
       sRefSet_free (s->deriv);
       s->deriv = sRefSet_undefined;
 
-      /*@i43@*/ /* valueTable_free (s->state); */
+      valueTable_free (s->state); 
       sinfo_free (s);
       
       
@@ -6096,7 +6112,7 @@ void sRef_free (/*@only@*/ sRef s)
       s->definfo = stateInfo_undefined;
       s->nullinfo = stateInfo_undefined;
 
-      /*@i32@*/ sfree (s);
+      sfree (s);
     }
 }
 
@@ -6273,7 +6289,7 @@ sRef_buildNCField (/*@exposed@*/ sRef rec, /*@exposed@*/ cstring f)
       s->kind = SK_FIELD;
       s->info = (sinfo) dmalloc (sizeof (*s->info));
       s->info->field = (fldinfo) dmalloc (sizeof (*s->info->field));
-      s->info->field->rec = rec; /* sRef_copy (rec); */ /*@i32@*/
+      s->info->field->rec = rec;
       s->info->field->field = f; /* doesn't copy f */
       
       if (ctype_isKnown (ct) && ctype_isSU (ct))
@@ -6310,7 +6326,7 @@ sRef_buildNCField (/*@exposed@*/ sRef rec, /*@exposed@*/ cstring f)
              
              s->oaliaskind = s->aliaskind;
              s->oexpkind = s->expkind;
-             
+
              DPRINTF (("sref: %s", sRef_unparseFull (s)));
            }
          else
@@ -6424,9 +6440,11 @@ void sRef_setArrayFetchState (/*@notnull@*/ /*@exposed@*/ sRef s,
          
          if (ctype_isMutable (s->type))
            {
-             sRef_setExKind (s, sRef_getExKind (sp), fileloc_undefined);
-                     
+             s->expkind = sRef_getExKind (sp);
+             s->expinfo = stateInfo_copy (sp->expinfo);
+             
              s->aliaskind = sp->aliaskind;
+             s->aliasinfo = stateInfo_copy (sp->aliasinfo);
            }
 
          s->defstate = sp->defstate;
@@ -6470,8 +6488,9 @@ void sRef_setArrayFetchState (/*@notnull@*/ /*@exposed@*/ sRef s,
              */
            }
 
-         sRef_setExKind (s, sRef_getExKind (arr), g_currentloc);
-
+         s->expkind = sRef_getExKind (arr);
+         s->expinfo = stateInfo_copy (arr->expinfo);
+         
          if (arr->aliaskind == AK_LOCAL || arr->aliaskind == AK_FRESH)
            {
              s->aliaskind = AK_LOCAL;
@@ -6588,6 +6607,7 @@ void sRef_setArrayFetchState (/*@notnull@*/ /*@exposed@*/ sRef s,
   if (sRef_isObserver (arr)) 
     {
       s->expkind = XO_OBSERVER;
+      s->expinfo = stateInfo_copy (arr->expinfo);
     }
 }  
 
@@ -6619,7 +6639,9 @@ void sRef_setArrayFetchState (/*@notnull@*/ /*@exposed@*/ sRef s,
          return res;
        }
 
-      sRef_setExKind (s, sRef_getExKind (arr), g_currentloc);
+      s->expkind = sRef_getExKind (arr);
+      s->expinfo = stateInfo_copy (arr->expinfo);
+
       return s;
     }
   else
@@ -6631,7 +6653,7 @@ void sRef_setArrayFetchState (/*@notnull@*/ /*@exposed@*/ sRef s,
       s->info->arrayfetch = (ainfo) dmalloc (sizeof (*s->info->arrayfetch));
       s->info->arrayfetch->indknown = FALSE;
       s->info->arrayfetch->ind = 0;
-      s->info->arrayfetch->arr = arr; /* sRef_copy (arr); */ /*@i32@*/
+      s->info->arrayfetch->arr = arr;
 
       sRef_setArrayFetchState (s, arr);
 
@@ -6645,7 +6667,8 @@ void sRef_setArrayFetchState (/*@notnull@*/ /*@exposed@*/ sRef s,
       
       if (valueTable_isUndefined (s->state))
        {
-         s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc));
+         s->state = context_createValueTable 
+           (s, stateInfo_makeLoc (g_currentloc, SA_CREATED));
        }
       
       return (s);
@@ -6684,7 +6707,9 @@ void sRef_setArrayFetchState (/*@notnull@*/ /*@exposed@*/ sRef s,
          return res;
        }
 
-      sRef_setExKind (s, sRef_getExKind (arr), g_currentloc);      
+      s->expkind = sRef_getExKind (arr);
+      s->expinfo = stateInfo_copy (arr->expinfo);
+
       llassert (s->info->arrayfetch->arr == arr);
       return s;
     }
@@ -6695,7 +6720,7 @@ void sRef_setArrayFetchState (/*@notnull@*/ /*@exposed@*/ sRef s,
       s->kind = SK_ARRAYFETCH;
       s->info = (sinfo) dmalloc (sizeof (*s->info));
       s->info->arrayfetch = (ainfo) dmalloc (sizeof (*s->info->arrayfetch));
-      s->info->arrayfetch->arr = arr; /* sRef_copy (arr); */ /*@i32@*/
+      s->info->arrayfetch->arr = arr;
       s->info->arrayfetch->indknown = TRUE;
       s->info->arrayfetch->ind = i;
 
@@ -6707,7 +6732,7 @@ void sRef_setArrayFetchState (/*@notnull@*/ /*@exposed@*/ sRef s,
       sRef_addDeriv (arr, s);
 
       llassert (valueTable_isUndefined (s->state));
-      s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc));
+      s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc, SA_CREATED));
       return (s);
     }
 }
@@ -6817,8 +6842,9 @@ sRef_setStateFromUentry (sRef s, uentry ue)
 
       if (sRef_isReasonable (s))
        {
-         
-         sRef_setExKind (s, sRef_getExKind (t), g_currentloc);
+         s->expkind = sRef_getExKind (t);
+         s->expinfo = stateInfo_copy (t->expinfo);       
+
          s->oaliaskind = s->aliaskind;
          s->oexpkind = s->expkind;
 
@@ -6903,7 +6929,7 @@ sRef_constructPointerAux (/*@notnull@*/ /*@exposed@*/ sRef t)
 
   s->kind = SK_PTR;
   s->info = (sinfo) dmalloc (sizeof (*s->info));
-  s->info->ref = t; /* sRef_copy (t); */ /*@i32*/
+  s->info->ref = t; 
   
   if (ctype_isRealAP (rt))
     {
@@ -6915,14 +6941,17 @@ sRef_constructPointerAux (/*@notnull@*/ /*@exposed@*/ sRef t)
   if (t->defstate == SS_UNDEFINED)
     {
       s->defstate = SS_UNUSEABLE;
+      s->definfo = stateInfo_copy (t->definfo);
     }
   else if ((t->defstate == SS_ALLOCATED) && !ctype_isSU (st))
     {
       s->defstate = SS_UNDEFINED;
+      s->definfo = stateInfo_copy (t->definfo);
     }
   else
     {
       s->defstate = t->defstate;
+      s->definfo = stateInfo_copy (t->definfo);
     }
   
   if (t->aliaskind == AK_LOCAL || t->aliaskind == AK_FRESH)
@@ -6934,7 +6963,9 @@ sRef_constructPointerAux (/*@notnull@*/ /*@exposed@*/ sRef t)
       s->aliaskind = AK_UNKNOWN;
     }
 
-  sRef_setExKind (s, sRef_getExKind (t), fileloc_undefined);
+  s->expkind = sRef_getExKind (t);
+  s->expinfo = stateInfo_copy (t->expinfo);
+
   sRef_setTypeState (s);
 
   s->oaliaskind = s->aliaskind;
@@ -6942,9 +6973,10 @@ sRef_constructPointerAux (/*@notnull@*/ /*@exposed@*/ sRef t)
 
   if (valueTable_isUndefined (s->state))
     {
-      s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc));
+      s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc, SA_CREATED));
     }
 
+  DPRINTF (("pointer: %s", sRef_unparseFull (s)));
   return s;
 }
 
@@ -6987,7 +7019,7 @@ sRef_clearDerivedComplete (sRef s)
 {
   sRef res = sRef_buildPointer (s); 
 
-  DPRINTF (("Res: %s", sRef_unparse (res)));
+  DPRINTF (("Res: %s", sRef_unparseFull (res)));
   return res;
 }
 
@@ -7220,10 +7252,8 @@ sRef_copyState (sRef s1, sRef s2)
       s1->nullstate = s2->nullstate;
       s1->nullinfo = stateInfo_update (s1->nullinfo, s2->nullinfo);
 
-      /*@-mustfree@*/
-      /*@i834 don't free it: valueTable_free (s1->state); */
-      /*@i32@*/ s1->state = valueTable_copy (s2->state);
-      /*@=mustfree@*/
+      valueTable_free (s1->state);  
+      s1->state = valueTable_copy (s2->state);
       s1->safe = s2->safe;
     }
 }
@@ -7294,7 +7324,7 @@ sRef_makeType (ctype ct)
   s->oaliaskind = s->aliaskind;
   s->oexpkind = s->expkind;
   llassert (valueTable_isUndefined (s->state));
-  s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc));
+  s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc, SA_CREATED));
 
   DPRINTF (("Create: %s", sRef_unparseFull (s)));
   return s;
@@ -7315,7 +7345,9 @@ sRef_makeConst (ctype ct)
   /* start modification */
   s->bufinfo.bufstate = BB_NULLTERMINATED;
   /* end modification */
-  if (ctype_isUA (ct))
+
+  /* evans 2002-04-22: added isManifestBool to avoid errors for -boolfalse initializations */
+  if (!ctype_isManifestBool (ct) && ctype_isUA (ct)) 
     {
       typeId uid = ctype_typeId (ct);
       uentry te = usymtab_getTypeEntrySafe (uid);
@@ -7326,12 +7358,11 @@ sRef_makeConst (ctype ct)
        }
     }
   
-  
   s->oaliaskind = s->aliaskind;
   s->oexpkind = s->expkind;
 
   llassert (valueTable_isUndefined (s->state));
-  s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc));
+  s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc, SA_CREATED));
 
   return s;
 }
@@ -7746,10 +7777,14 @@ sRef_showRefLost (sRef s)
 void
 sRef_showRefKilled (sRef s)
 {
-  if (sRef_hasStateInfoLoc (s))
+  if (sRef_isValid (s)) 
     {
-      llgenindentmsg (message ("Storage %q released", 
-                              sRef_unparse (s)), sRef_getStateInfoLoc (s));
+      DPRINTF (("Killed: %s", sRef_unparseFull (s)));
+      if (context_getLocIndentSpaces () == 0) {
+       stateInfo_display (s->definfo, message ("  Storage %q", sRef_unparseOpt (s)));
+      } else {
+       stateInfo_display (s->definfo, message ("Storage %q", sRef_unparseOpt (s)));
+      }
     }
 }
 
@@ -7768,49 +7803,25 @@ sRef_showStateInconsistent (sRef s)
 void
 sRef_showStateInfo (sRef s)
 {
-  if (sRef_hasStateInfoLoc (s))
-    {
-      if (s->defstate == SS_DEAD)
-       {
-         llgenindentmsg 
-           (message ("Storage %qis released", sRef_unparseOpt (s)),
-            sRef_getStateInfoLoc (s));
-       }
-      else if (s->defstate == SS_ALLOCATED || s->defstate == SS_DEFINED)
-       {
-         llgenindentmsg 
-           (message ("Storage %qis %s", sRef_unparseOpt (s), 
-                     sstate_unparse (s->defstate)),
-            sRef_getStateInfoLoc (s));
-       }
-      else if (s->defstate == SS_UNUSEABLE)
-       {
-         llgenindentmsg 
-           (message ("Storage %qbecomes inconsistent (clauses merge with"
-                     "%qreleased on one branch)",
-                     sRef_unparseOpt (s), 
-                     sRef_unparseOpt (s)),
-            sRef_getStateInfoLoc (s));
-       }
-      else 
-       {
-         llgenindentmsg (message ("Storage %qbecomes %s", 
-                                  sRef_unparseOpt (s), 
-                                  sstate_unparse (s->defstate)),
-                         sRef_getStateInfoLoc (s));
-       }
+  if (sRef_isValid (s)) {
+    if (context_getLocIndentSpaces () == 0) {
+      stateInfo_display (s->definfo, message ("   Storage %q", sRef_unparseOpt (s)));
+    } else {
+      stateInfo_display (s->definfo, message ("Storage %q", sRef_unparseOpt (s)));
     }
+  }
 }
 
 void
 sRef_showExpInfo (sRef s)
 {
-  if (sRef_hasExpInfoLoc (s))
-    {
-      llgenindentmsg (message ("Storage %qbecomes %s", sRef_unparseOpt (s), 
-                              exkind_unparse (s->expkind)),
-                     sRef_getExpInfoLoc (s));
+  if (sRef_isValid (s)) {
+    if (context_getLocIndentSpaces () == 0) {
+      stateInfo_display (s->expinfo, message ("   Storage %q", sRef_unparseOpt (s)));
+    } else {
+      stateInfo_display (s->expinfo, message ("Storage %q", sRef_unparseOpt (s)));
     }
+  }
 }
 
 void
@@ -7907,24 +7918,23 @@ sRef_showNullInfo (sRef s)
 void
 sRef_showAliasInfo (sRef s)
 {
-  if (sRef_hasAliasInfoLoc (s))
+  if (sRef_isValid (s)) 
     {
       if (sRef_isFresh (s))
        {
-         llgenindentmsg 
-           (message ("Fresh storage %qallocated", sRef_unparseOpt (s)),
-            sRef_getAliasInfoLoc (s));
+         if (context_getLocIndentSpaces () == 0) {
+           stateInfo_display (s->aliasinfo, message ("   Fresh storage %q", sRef_unparseOpt (s)));
+         } else {
+           stateInfo_display (s->aliasinfo, message ("Fresh storage %q", sRef_unparseOpt (s)));
+         }
        }
-      else 
+      else
        {
-         if (!sRef_isRefCounted (s))
-           {
-             llgenindentmsg 
-               (message ("Storage %qbecomes %s", 
-                         sRef_unparseOpt (s),
-                         alkind_unparse (sRef_getAliasKind (s))),
-                sRef_getAliasInfoLoc (s));
-           }
+         if (context_getLocIndentSpaces () == 0) {
+           stateInfo_display (s->aliasinfo, message ("   Storage %q", sRef_unparseOpt (s))); 
+         } else {
+           stateInfo_display (s->aliasinfo, message ("Storage %q", sRef_unparseOpt (s)));
+         }
        }
     }
 }
@@ -7940,7 +7950,7 @@ sRef_mergeNullState (sRef s, nstate n)
       
       if (n != old && n != NS_UNKNOWN)
        {                 
-           sRef_setNullState (s, n, g_currentloc);
+         sRef_setNullState (s, n, g_currentloc);
        }
     }
   else
@@ -7953,11 +7963,11 @@ bool
 sRef_possiblyNull (sRef s)
 {
   if (sRef_isReasonable (s))
-      {
-       if (sRef_getNullState (s) == NS_ABSNULL)
+    {
+      if (sRef_getNullState (s) == NS_ABSNULL)
        {
          ctype rct = ctype_realType (s->type);
-
+         
          if (ctype_isAbstract (rct))
            {
              return FALSE;
@@ -7982,7 +7992,7 @@ sRef_possiblyNull (sRef s)
          return nstate_possiblyNull (sRef_getNullState (s));
        }
     }
-
+  
   return FALSE;
 }
 
@@ -8866,6 +8876,16 @@ static void
     {
       res->aliaskind = AK_KEPT;
     }
+  else if ((ares == AK_OWNED && aother == AK_ONLY)
+          || (aother == AK_OWNED && ares == AK_ONLY))
+    {
+      res->aliaskind = AK_OWNED;
+
+      if (aother == AK_OWNED)
+       {
+         res->aliasinfo = stateInfo_update (res->aliasinfo, other->aliasinfo);
+       }
+    }
   else
     {
       hasError = TRUE;
@@ -9182,13 +9202,13 @@ static /*@null@*/ sinfo sinfo_copy (/*@notnull@*/ sRef s)
       ret->arrayfetch = (ainfo) dmalloc (sizeof (*ret->arrayfetch));
       ret->arrayfetch->indknown = s->info->arrayfetch->indknown;
       ret->arrayfetch->ind = s->info->arrayfetch->ind;
-      ret->arrayfetch->arr = s->info->arrayfetch->arr; /* sRef_copy (s->info->arrayfetch->arr); */ /*@i32@*/
+      ret->arrayfetch->arr = s->info->arrayfetch->arr; 
       break;
 
     case SK_FIELD:
       ret = (sinfo) dmalloc (sizeof (*ret));
       ret->field = (fldinfo) dmalloc (sizeof (*ret->field));
-      ret->field->rec = s->info->field->rec; /* sRef_copy (s->info->field->rec); */ /*@i32@*/
+      ret->field->rec = s->info->field->rec; 
       ret->field->field = s->info->field->field; 
       break;
 
@@ -9215,11 +9235,13 @@ static /*@null@*/ sinfo sinfo_copy (/*@notnull@*/ sRef s)
       ret = (sinfo) dmalloc (sizeof (*ret));
       ret->spec = s->info->spec;
       break;
+
     case SK_UNCONSTRAINED:
     case SK_NEW:
       ret = (sinfo) dmalloc (sizeof (*ret));
       ret->fname = s->info->fname;
       break;
+
     case SK_RESULT:
     case SK_CONST:
     case SK_TYPE:
@@ -9406,7 +9428,7 @@ static void sinfo_free (/*@special@*/ /*@temp@*/ /*@notnull@*/ sRef s)
     case SK_PTR:
     case SK_ADR:
     case SK_DERIVED:
-    case SK_EXTERNAL: /*@i32 is copy now! */
+    case SK_EXTERNAL: /* is copy now! */
       break;
 
     case SK_CONJ:
@@ -9841,9 +9863,11 @@ void sRef_reflectAnnotation (sRef s, annotationInfo a, fileloc loc)
       if (!valueTable_isDefined (s->state))
        {
          s->state = valueTable_create (1);
-         valueTable_insert (s->state, 
-                            cstring_copy (metaStateInfo_getName (annotationInfo_getState (a))),
-                            stateValue_create (annotationInfo_getValue (a), stateInfo_makeLoc (loc)));
+         valueTable_insert
+           (s->state, 
+            cstring_copy (metaStateInfo_getName (annotationInfo_getState (a))),
+            stateValue_create (annotationInfo_getValue (a), 
+                               stateInfo_makeLoc (loc, SA_DECLARED)));
        }
       else
        {
@@ -9851,8 +9875,9 @@ void sRef_reflectAnnotation (sRef s, annotationInfo a, fileloc loc)
          valueTable_update 
            (s->state,
             metaStateInfo_getName (annotationInfo_getState (a)),
-            stateValue_create (annotationInfo_getValue (a), stateInfo_makeLoc (loc)));
-         DPRINTF (("state info: %s", stateInfo_unparse (stateInfo_makeLoc (loc))));
+            stateValue_create (annotationInfo_getValue (a),
+                               stateInfo_makeLoc (loc, SA_DECLARED)));
+         
          DPRINTF (("sref: %s", sRef_unparse (s)));
          DPRINTF (("sref: %s", sRef_unparseFull (s)));
        }
@@ -9888,7 +9913,8 @@ void sRef_setMetaStateValue (sRef s, cstring key, int value, fileloc loc)
          DPRINTF (("inserting state: %s: %s %d", sRef_unparse (s), key, value));
          s->state = valueTable_create (1);
          valueTable_insert (s->state, cstring_copy (key),
-                            stateValue_create (value, stateInfo_makeLoc (loc)));
+                            stateValue_create (value, 
+                                               stateInfo_makeLoc (loc, SA_CHANGED)));
        }
       else
        {
@@ -9897,12 +9923,14 @@ void sRef_setMetaStateValue (sRef s, cstring key, int value, fileloc loc)
          if (valueTable_contains (s->state, key))
            {
              valueTable_update 
-               (s->state, key, stateValue_create (value, stateInfo_makeLoc (loc)));
+               (s->state, key, stateValue_create (value,
+                                                  stateInfo_makeLoc (loc, SA_CHANGED)));
            }
          else
            {
              valueTable_insert 
-               (s->state, cstring_copy (key), stateValue_create (value, stateInfo_makeLoc (loc)));
+               (s->state, cstring_copy (key),
+                stateValue_create (value, stateInfo_makeLoc (loc, SA_CHANGED)));
            }
 
          DPRINTF (("After: %s", sRef_unparseFull (s)));
@@ -9982,7 +10010,7 @@ bool sRef_makeStateSpecial (sRef s)
   ** Default defined state can be made special.
   */
 
-  llassert (sRef_isReasonable (s)); /*@i523 why doesn't null-checking work!??? */
+  llassert (sRef_isReasonable (s));
 
   if (s->defstate == SS_UNKNOWN || s->defstate == SS_DEFINED || s->defstate == SS_SPECIAL)
     {
@@ -10100,19 +10128,25 @@ bool sRef_isFixedArray (sRef p_s) /*@*/ {
   return ( ctype_isFixedArray (c) );
 }
 
-long int sRef_getArraySize (sRef p_s) /*@*/ {
+size_t sRef_getArraySize (sRef p_s) /*@*/ 
+{
   ctype c;
   llassert (sRef_isFixedArray(p_s) );
   DPRINTF (( message ("sRef_getArraySize getting array size for %s", sRef_unparse(p_s) )  ));
   
   c = sRef_getType (p_s);
-
-  return (ctype_getArraySize (c) );
+  return (ctype_getArraySize (c));
 }
 
 void sRef_setValue (sRef s, multiVal val)
 {
-  llassert (sRef_isReasonable (s));
+  if (!sRef_isReasonable (s))
+    {
+      llcontbuglit ("Unreasonable sRef");
+      llcontbug (message ("sRef: %s", sRef_unparse (s)));
+      return;
+    }
+
   multiVal_free (s->val);
   s->val = val;
 }
This page took 0.107616 seconds and 4 git commands to generate.