Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cparser/Cutil.ml
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,8 @@ let sizeof_layout_struct env members ma =
(record_field m.fld_name pos :: accu)
rem
| Some width ->
(* bit fields must be naturally aligned *)
assert (alignas_attribute (attributes_of_type env m.fld_typ) = 0);
(* curr = beginning of storage unit, in bits
next = one past end of storage unit, in bits *)
let curr = pos / (a * 8) * (a * 8) in
Expand Down
2 changes: 1 addition & 1 deletion cparser/Elab.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ and elab_field_group env = function
error loc
"the type of bit-field '%a' must be an integer type no bigger than 'int'" pp_field id;
None,env
end else if has_std_alignas env' ty then begin
end else if alignas_attribute (attributes_of_type env' ty) > 0 then begin
error loc "alignment specified for bit-field '%a'" pp_field id;
None, env
end else begin
Expand Down
Loading