Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions src/cil.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2364,6 +2364,13 @@ and intOfAttrparam (a:attrparam) : int option =
bs / 8
| AAlignOf(t) ->
alignOf_int t
| ABinOp (op, lhs, rhs) -> begin
let lhs_val = doit lhs in
let rhs_val = doit rhs in
match op with
Mult -> lhs_val * rhs_val
| _ -> raise (SizeOfError ("", voidType))
end
| _ -> raise (SizeOfError ("", voidType))
in
(* Use ignoreAlignmentAttrs here to prevent stack overflow if a buggy
Expand Down
8 changes: 8 additions & 0 deletions test/small1/attr-multiplication.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
struct S1 {
char a;
} __attribute__((aligned(sizeof(short) * sizeof(int))));


struct S2 {
int x: __builtin_choose_expr(__alignof__ (struct S1) == sizeof(short) * sizeof(int), 1, -1);
} s2;