Changes between Version 114 and Version 115 of IR2


Ignore:
Timestamp:
06/03/21 22:36:30 (5 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IR2

    v114 v115  
    130130  | '$heap'  /* heap type, for dynamic allocation */
    131131  | '$mem'  /* set of memory locations */
     132  | '$type' '<' type-name '>'  /* a value type of a named static type */
    132133  | 'struct' ID  type-param-list?  /* structure type */
    133134  | 'union' ID  type-param-list?  /* union type */
     
    252253  | '&' lvalue  /* address-of */
    253254  | expr type-args? '(' expression-list? ')'  /* application of abstract function (and perhaps other functions?) */
    254   | '$fresh' '(' allocator ')'  /* returns a new arbitrary value of the given type */
    255   | '$new' '(' allocator ')'  /* returns a new arbitrary and undefined value of the given type */
     255  | '$typeof' '(' type-name ')'  /* value type named by the extended type name */
     256  | '$fresh' '(' expr ')'  /* returns a new arbitrary value of the given type */
     257  | '$new' '(' expr ')'  /* returns a new arbitrary and undefined value of the given complete type */
    256258  | '$forall' '(' decl expr? ')' expr  /* universal quantification */
    257259  | '$exists' '(' decl expr? ')' expr  /* existential quantification */
     
    292294  * A pointer becomes defined when assigned the result of an `$alloc`.   Each element in the newly allocated object is undefined.
    293295  * Example: to determine whether it is safe to read `*(p+i)`, assert `$summable(p, i) && $valid(p+i) && $defined(*(p+i))`.  You must check (1) you can sum `p` and `i`, (2) `p+i` points to an object of the base type, so dereference is safe, and (3) the object is defined (has been assigned a value).  If you aren't sure `p` and `i` have been defined, you can add `$defined(p) && $defined(i)` to the assertion.   It may be more efficient to use temporary variables and break this up into multiple assertions.
     296  * `$fresh` and `$new` consume an argument of type `$type<T>` and return a value of type `T`.  For `$new`, the argument must specify a complete type.
    294297
    295298=== How to implement `$defined` using symbolic execution ===