2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / pr60700.c
blob5428f3616237ebbbf21dfa6dc61f9bd0b0b9a9e2
1 /* PR rtl-optimization/60700 */
2 /* { dg-do run { target ia32 } } */
3 /* { dg-options "-O3 -march=i686" } */
5 int
6 __attribute__((noinline))
7 foo (void)
9 return 0;
12 void *g = (void *)1;
14 struct st {
15 char data[36]; /* must be greater than 32. */
18 int
19 __attribute__((noinline))
20 repro(struct st **out)
22 int status = 0;
24 *out = 0;
26 status = foo();
27 if (status != 0) {
28 return status;
31 if (0 == g) {
32 status = 999;
33 return status;
36 *out = (struct st *)__builtin_malloc(sizeof(struct st));
37 if (0 == *out) {
38 status = 42;
39 return status;
42 __builtin_memset(*out, 0, sizeof(struct st));
44 return status;
47 int
48 main ()
50 struct st *p;
51 int ret = repro (&p);
52 unsigned int i;
54 for (i = 0; i < sizeof (p->data)/sizeof (p->data[0]); i++)
55 if (p->data[i] != 0)
56 __builtin_abort ();
58 return ret;