aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2016-08-25 13:48:05 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2016-08-25 13:48:05 +0200
commit640babdc9ea0958de967ce8b5ac84bb0309b3835 (patch)
tree49c82b1d5fada64b55b7913029af0edb4d1d5ea1
parent7a88871feb652a3b094f3fdc8c7e933ab6eb16d3 (diff)
downloadcompcert-640babdc9ea0958de967ce8b5ac84bb0309b3835.tar.gz
compcert-640babdc9ea0958de967ce8b5ac84bb0309b3835.zip
Test if struct is redefined as union or otherwise.
If a declaration of a composite is encountered it is also tested if the kind is equal. Bug 19630.
-rw-r--r--cparser/Elab.ml2
1 files changed, 2 insertions, 0 deletions
diff --git a/cparser/Elab.ml b/cparser/Elab.ml
index f8d2cb77..6c039d9b 100644
--- a/cparser/Elab.ml
+++ b/cparser/Elab.ml
@@ -838,6 +838,8 @@ and elab_struct_or_union only kind loc tag optmembers attrs env =
and the composite was bound in another scope,
create a new incomplete composite instead via the case
"_, None" below. *)
+ if ci.ci_kind <> kind then
+ fatal_error loc "struct/union mismatch on tag '%s'" tag;
warn_attrs();
(tag', env)
| Some(tag', ({ci_sizeof = None} as ci)), Some members