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
5 changes: 2 additions & 3 deletions src/frontc/cabs2cil.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5876,12 +5876,11 @@ and createAutoLocal ((((n, ndt, a, cloc) : A.name), (inite: A.init_expression))
else
match inite with
| SINGLE_INIT exp ->
(match doPureExp exp with
| Some exp ->
(match doExp true exp (AExp None) with
| (_, exp, _) ->
let t = Cil.typeOf exp in
let specs = t,NoStorage,false,[] in
createLocal specs name
| None -> E.s (error "__auto_type but init not pure")
)
| _ -> E.s (error "__auto_type but not SINGLE_INIT")
(* Must catch the Static local variables. Make them global *)
Expand Down
14 changes: 14 additions & 0 deletions test/small1/auto_type1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
struct dummmy {
char arr[0x0bad];
};

extern volatile struct dummmy side_effect1;
struct dummmy side_effect2(struct dummmy);

void *fn() {
__auto_type x = side_effect2(side_effect1);
static struct S1 {
int a : __builtin_choose_expr(sizeof(x) == 0x0bad, 1, -1);
} s1 = {0};
return &s1;
}
Loading