Skip to content

Commit

Permalink
relaxes the bitfield declaration (#52)
Browse files Browse the repository at this point in the history
Modern compilers accept bitfields with typedefed types despite that the
standard is not quite clear if this acceptable. FrontC strictly
requires a builtin integer type, e.g., `int`, `unsigned`, or `signed`
as the type of bitfiled. The reason for this is that we need to lookup
for the signedness of the field to construct a proper bitfield and
since we're not storing the original type of a typedefed type anywhere
we can't get this information for a typedefed type. The quick fix is
to keep signedness unspecified for the typedefed types.

Fixes #51
  • Loading branch information
ivg authored Sep 7, 2021
1 parent e85e417 commit c95d785
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion frontc/cparser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
| BITFIELD (NO_SIGN, exp) ->
(match tst with
INT (_, sign) -> BITFIELD (sign, exp)
| _ -> raise BadType)
| _ -> typ)
| _ -> raise BadType in
set tin

Expand Down

0 comments on commit c95d785

Please sign in to comment.