diff options
author | Bernhard Schommer <bernhardschommer@gmail.com> | 2016-08-23 10:50:48 +0200 |
---|---|---|
committer | Bernhard Schommer <bernhardschommer@gmail.com> | 2016-08-23 10:50:48 +0200 |
commit | c3c0aba2ed285bc33208cfc67667f47d6d1b0762 (patch) | |
tree | 666ace2761c58fde7fabd3668dda1d29540def5e /cparser/Cutil.ml | |
parent | e829671ab99a98dca212c6f29d29b952dbc1fa80 (diff) | |
download | compcert-kvx-c3c0aba2ed285bc33208cfc67667f47d6d1b0762.tar.gz compcert-kvx-c3c0aba2ed285bc33208cfc67667f47d6d1b0762.zip |
Fix for initialization of incomplete types
Since some incomplete types are allowed in initialization just
test whether the default initilization exists.
Bug 19601
Diffstat (limited to 'cparser/Cutil.ml')
-rw-r--r-- | cparser/Cutil.ml | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cparser/Cutil.ml b/cparser/Cutil.ml index 4b4e1b81..c8966941 100644 --- a/cparser/Cutil.ml +++ b/cparser/Cutil.ml @@ -1026,6 +1026,7 @@ let formatloc pp (filename, lineno) = if filename <> "" then Format.fprintf pp "%s:%d: " filename lineno (* Generate the default initializer for the given type *) +exception No_default_init let rec default_init env ty = match unroll env ty with @@ -1049,11 +1050,11 @@ let rec default_init env ty = | TUnion(id, _) -> let ci = Env.find_union env id in begin match ci.ci_members with - | [] -> assert false + | [] -> raise No_default_init | fld :: _ -> Init_union(id, fld, default_init env fld.fld_typ) end | _ -> - assert false + raise No_default_init (* Substitution of variables by expressions *) |