PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / uninit-9.c
blobd1af7328a96ac7e9c9e306f12b2bd0e3245727ae
1 /* Spurious uninitialized variable warnings. Slight variant on the
2 documented case, inspired by reg-stack.c:record_asm_reg_life. */
4 /* { dg-do compile } */
5 /* { dg-options "-O -Wuninitialized" } */
6 /* { dg-require-effective-target alloca } */
8 struct foo
10 int type;
11 struct foo *car;
12 struct foo *cdr;
13 char *data;
14 int data2;
17 extern void use(struct foo *);
19 #define CLOBBER 6
20 #define PARALLEL 3
22 void
23 func(struct foo *list, int count)
25 int n_clobbers = 0;
26 int i;
27 struct foo **clob_list; /* { dg-bogus "clob_list" "uninitialized variable warning" } */
29 if(list[0].type == PARALLEL)
31 clob_list = __builtin_alloca(count * sizeof(struct foo *));
33 for(i = 1; i < count; i++)
35 if(list[i].type == CLOBBER)
36 clob_list[n_clobbers++] = &list[i];
40 for(i = 0; i < n_clobbers; i++)
41 use(clob_list[i]);