diff options
author | Bernhard Schommer <bschommer@users.noreply.github.com> | 2018-03-27 17:15:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-27 17:15:42 +0200 |
commit | fbc778079d50a4af45b9a648eab56cef29ac75f4 (patch) | |
tree | 8131a5099e363d68dc3a565e83ed72485138606f /cparser/Cutil.ml | |
parent | 2b79fd958026b3a9bcdd2452b1a4c217a084de92 (diff) | |
download | compcert-fbc778079d50a4af45b9a648eab56cef29ac75f4.tar.gz compcert-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.ml | 10 |
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. |