Skip to content

Commit e9e74e8

Browse files
authored
[ASL] Fix bug where environment updates from IF test expressions were reverted (herd#1800)
1 parent 18bf65f commit e9e74e8

4 files changed

Lines changed: 17 additions & 7 deletions

File tree

asllib/Interpreter.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ module Make (B : Backend.S) (C : Config) = struct
632632
(fun () -> eval_expr_sef env1 e1)
633633
(fun () -> eval_expr_sef env1 e2)
634634
in
635-
return_normal (v, env) |: SemanticsRule.ECondSimple
635+
return_normal (v, env1)
636636
else
637637
choice_with_branch_effect env1 m_cond e_cond e1 e2 (fun (env, v) ->
638638
eval_expr env v)

asllib/instrumentation.ml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ module SemanticsRule = struct
3636
| BinopOr
3737
| BinopImpl
3838
| Unop
39-
| ECondSimple
4039
| ECond
4140
| ESlice
4241
| ECall
@@ -138,7 +137,6 @@ module SemanticsRule = struct
138137
| ETuple -> "ETuple"
139138
| EArray -> "EArray"
140139
| EEnumArray -> "EEnumArray"
141-
| ECondSimple -> "ECondSimple"
142140
| EGetArray -> "EGetArray"
143141
| EGetEnumArray -> "EGetEnumArray"
144142
| ESliceError -> "ESliceError"
@@ -221,7 +219,6 @@ module SemanticsRule = struct
221219
BinopOr;
222220
BinopImpl;
223221
Unop;
224-
ECondSimple;
225222
ECond;
226223
ESlice;
227224
ECall;
@@ -353,7 +350,6 @@ module TypingRule = struct
353350
| EVar
354351
| Binop
355352
| Unop
356-
| ECondSimple
357353
| ECond
358354
| ESlice
359355
| ECall
@@ -558,7 +554,6 @@ module TypingRule = struct
558554
| EGetFields -> "EGetFields"
559555
| EConcat -> "EConcat"
560556
| ETuple -> "ETuple"
561-
| ECondSimple -> "ECondSimple"
562557
| EGetArray -> "EGetArray"
563558
| ESliceError -> "ESliceError"
564559
| EArbitrary -> "EArbitrary"
@@ -752,7 +747,6 @@ module TypingRule = struct
752747
EPattern;
753748
EGetArray;
754749
ESliceError;
755-
ECondSimple;
756750
EConcat;
757751
ETuple;
758752
LEDiscard;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var myglob : integer = 0;
2+
func mytest () => boolean
3+
begin
4+
myglob = 1;
5+
return TRUE;
6+
end;
7+
func main () => integer
8+
begin
9+
var test = if mytest() then 0 else 1;
10+
assert myglob == 1;
11+
return 0;
12+
end;

asllib/tests/regressions.t/run.t

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,3 +722,7 @@ Bounds checks
722722
ASL Dynamic error: Mismatch type:
723723
value 100 does not belong to type integer {0..3}.
724724
[1]
725+
726+
If test environment reversion bug
727+
$ aslref if-test-env-updated.asl
728+

0 commit comments

Comments
 (0)