Skip to content
Snippets Groups Projects
Commit 061b5aa8 authored by Virgile Prevosto's avatar Virgile Prevosto
Browse files

[rte] fatal error if accessing an object whose type is an undefined union

parent 8fa891ec
No related branches found
No related tags found
No related merge requests found
......@@ -111,15 +111,18 @@ let lval_initialized_assertion ~remove_trivial:_ ~on_alarm lv =
| NoOffset ->
begin
match typ with
| TComp({cstruct = false; cfields} ,_,_) ->
| TComp({cstruct = false; cfields; cname} ,_,_) ->
(match cfields with
| Some [] | None -> () (* empty union, supported by gcc with size 0.
Trivially initialized. *)
| _ ->
| None ->
Options.fatal
"Access to an object of undefined union %a"
Printer.pp_varname cname
| Some [] -> () (* empty union, supported by gcc with size 0.
Trivially initialized. *)
| Some l ->
let llv =
List.map
(fun fi -> Cil.addOffsetLval (Field (fi, NoOffset)) lv)
(Option.get cfields)
(fun fi -> Cil.addOffsetLval (Field (fi, NoOffset)) lv) l
in
if default then
on_alarm ~invalid:false (Alarms.Uninitialized_union llv))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment