Changes between Version 114 and Version 115 of IR2
- Timestamp:
- 06/03/21 22:36:30 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
IR2
v114 v115 130 130 | '$heap' /* heap type, for dynamic allocation */ 131 131 | '$mem' /* set of memory locations */ 132 | '$type' '<' type-name '>' /* a value type of a named static type */ 132 133 | 'struct' ID type-param-list? /* structure type */ 133 134 | 'union' ID type-param-list? /* union type */ … … 252 253 | '&' lvalue /* address-of */ 253 254 | 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 */ 256 258 | '$forall' '(' decl expr? ')' expr /* universal quantification */ 257 259 | '$exists' '(' decl expr? ')' expr /* existential quantification */ … … 292 294 * A pointer becomes defined when assigned the result of an `$alloc`. Each element in the newly allocated object is undefined. 293 295 * 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. 294 297 295 298 === How to implement `$defined` using symbolic execution ===
