File tree Expand file tree Collapse file tree 5 files changed +18
-9
lines changed
books/kestrel/c/transformation Expand file tree Collapse file tree 5 files changed +18
-9
lines changed Original file line number Diff line number Diff line change 14141414 both argument expressions are pure,
14151415 since the order of evaluation is unspecified in C." )
14161416 (xdoc ::p
1417- " For pure non-strict binary operators,
1418- for now we also require both argument expressions to be pure
1419- in order to generate a theorem.
1420- But this could be relaxed, since in this case
1421- the order of evaluation is prescribed." )
1417+ " For non-strict binary operators (which are pure),
1418+ the argument expressions may be pure or not,
1419+ because the order of evaluation is always determined." )
14221420 (xdoc ::p
14231421 " For the non-pure strict simple assignment operator,
14241422 for theorem generation we require the left expression to be a variable.
14971495 :thm-name thm-name
14981496 :vartys gin.vartys))))
14991497 ((member-eq (binop-kind op) ' (:logand :logor ))
1500- (b* (((unless (and (expr-purep arg1)
1501- (expr-purep arg2)))
1502- (mv expr-new gout-no-thm))
1503- ((mv & old-arg1) (ldm-expr arg1)) ; ERP must be NIL
1498+ (b* (((mv & old-arg1) (ldm-expr arg1)) ; ERP must be NIL
15041499 ((mv & old-arg2) (ldm-expr arg2)) ; ERP must be NIL
15051500 ((mv & new-arg1) (ldm-expr arg1-new)) ; ERP must be NIL
15061501 ((mv & new-arg2) (ldm-expr arg2-new)) ; ERP must be NIL
Original file line number Diff line number Diff line change 3636 :content " int logand(short x, long y) {
3737 return x && y;
3838}
39+ int logand_nonpure(int x, int y, int z) {
40+ return (x = z) && (y = ~z);
41+ }
3942" )
4043
4144(assert-highest-thm-has-exec-fun *new-code* )
Original file line number Diff line number Diff line change 3636 :content " int logor(short x, long y) {
3737 return x || y;
3838}
39+ int logor_nonpure(int x, int y, int z) {
40+ return (x = !z) || (y = z);
41+ }
3942" )
4043
4144(assert-highest-thm-has-exec-fun *new-code* )
Original file line number Diff line number Diff line change 11int logand (short x , long y ) {
22 return x && y ;
33}
4+
5+ int logand_nonpure (int x , int y , int z ) {
6+ return (x = z ) && (y = ~z );
7+ }
Original file line number Diff line number Diff line change 11int logor (short x , long y ) {
22 return x || y ;
33}
4+
5+ int logor_nonpure (int x , int y , int z ) {
6+ return (x = !z + 0 ) || (y = z );
7+ }
You can’t perform that action at this time.
0 commit comments