Skip to content

Commit af65ce4

Browse files
committed
UnionDomain: Fix invariant generation for the case an offset is given.
1 parent e52b3c0 commit af65ce4

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/cdomains/unionDomain.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ struct
3838
end
3939
(* invariant for one field *)
4040
| Field (f, offset) ->
41-
let c_lval = Option.get lval in
4241
begin match lift_f with
4342
| `Lifted f' ->
4443
let v = Values.cast ~torg:f'.ftype f.ftype v in
45-
let f_lval = Cil.addOffsetLval (Field (f, NoOffset)) c_lval in
46-
value_invariant ~offset ~lval:(Some f_lval) v
44+
(* Do not add the field offset to lval here:
45+
Otherwise, for pointers to a member type of the union, this would
46+
generate an assertion with illegal field offset. *)
47+
value_invariant ~offset ~lval:lval v
4748
| `Top
4849
| `Bot ->
4950
Invariant.none

0 commit comments

Comments
 (0)