aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Cutil.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bschommer@users.noreply.github.com>2018-03-27 17:15:42 +0200
committerGitHub <noreply@github.com>2018-03-27 17:15:42 +0200
commitfbc778079d50a4af45b9a648eab56cef29ac75f4 (patch)
tree8131a5099e363d68dc3a565e83ed72485138606f /cparser/Cutil.ml
parent2b79fd958026b3a9bcdd2452b1a4c217a084de92 (diff)
downloadcompcert-kvx-fbc778079d50a4af45b9a648eab56cef29ac75f4.tar.gz
compcert-kvx-fbc778079d50a4af45b9a648eab56cef29ac75f4.zip
Sizeof and _Alignof are not allowed on bit-fields (#67)
Sizeof and _Alignof are not allowed on bit-fields Sizeof and _Alignof are not allowed to be applied to a expression that designates a bit-field member. Bug 23311
Diffstat (limited to 'cparser/Cutil.ml')
-rw-r--r--cparser/Cutil.ml10
1 files changed, 10 insertions, 0 deletions
diff --git a/cparser/Cutil.ml b/cparser/Cutil.ml
index 30037049..4a5c9427 100644
--- a/cparser/Cutil.ml
+++ b/cparser/Cutil.ml
@@ -988,6 +988,16 @@ let is_call_to_fun e s =
| EVar id -> id.C.name = s
| _ -> false
+let is_bitfield env e =
+ match e.edesc with
+ | EUnop(Odot f,b) ->
+ let fld = field_of_dot_access env b.etyp f in
+ fld.fld_bitfield <> None
+ | EUnop(Oarrow f,b) ->
+ let fld = field_of_arrow_access env b.etyp f in
+ fld.fld_bitfield <> None
+ | _ -> false
+
(* Assignment compatibility check over attributes.
Standard attributes ("const", "volatile", "restrict") can safely
be added (to the rhs type to get the lhs type) but must not be dropped.