aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Cutil.ml
diff options
context:
space:
mode:
authorDavid Monniaux <David.Monniaux@univ-grenoble-alpes.fr>2021-09-28 11:36:48 +0200
committerDavid Monniaux <David.Monniaux@univ-grenoble-alpes.fr>2021-09-28 11:36:48 +0200
commit539b81a1a8823fb4aac64a9493bf0bafea2f2560 (patch)
tree0dd9bb78f4e08889320e51812fd6c38b3fa7ad19 /cparser/Cutil.ml
parent95836bb256258951d10d1c5b59db6352ce241a12 (diff)
parent6ede270e6f386a099bc898307168e75ebd819c7e (diff)
downloadcompcert-kvx-539b81a1a8823fb4aac64a9493bf0bafea2f2560.tar.gz
compcert-kvx-539b81a1a8823fb4aac64a9493bf0bafea2f2560.zip
Merge branch 'master' of https://github.com/AbsInt/CompCert into towards_3.10
Diffstat (limited to 'cparser/Cutil.ml')
-rw-r--r--cparser/Cutil.ml13
1 files changed, 9 insertions, 4 deletions
diff --git a/cparser/Cutil.ml b/cparser/Cutil.ml
index d3a830ce..bcdea107 100644
--- a/cparser/Cutil.ml
+++ b/cparser/Cutil.ml
@@ -1263,11 +1263,16 @@ let rec default_init env ty =
let ci = Env.find_struct env id in
Init_struct(id, default_init_fields ci.ci_members)
| TUnion(id, _) ->
- let ci = Env.find_union env id in
- begin match ci.ci_members with
+ let ci = Env.find_union env id in
+ let rec default_init_field = function
| [] -> raise No_default_init
- | fld :: _ -> Init_union(id, fld, default_init env fld.fld_typ)
- end
+ | fld :: fl ->
+ if fld.fld_name = "" then
+ default_init_field fl
+ else
+ Init_union(id, fld, default_init env fld.fld_typ)
+ in
+ default_init_field ci.ci_members
| _ ->
raise No_default_init