PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / 20031202-1.c
bloba5e78456ba9ef4f48a1e58033f8640235763a2c5
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
3 /* { dg-options "-O2 -mtune=i686" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
5 extern void abort (void);
6 extern void exit (int);
8 struct A { char p[6]; } __attribute__((packed));
9 struct B {
10 struct A a;
11 void * const b;
12 struct A const * const c;
13 struct A const *d;
16 char v;
18 int __attribute__((noinline))
19 foo (struct B *b)
21 int i;
22 for (i = 0; i < 6; ++i)
23 if (b->a.p[i])
24 abort ();
25 if (b->b != &v || b->c || b->d)
26 abort ();
27 return 12;
30 int __attribute__((noinline))
31 bar (void *x)
33 __asm __volatile ("" : "=r" (x) : "0" (x));
34 struct B y = { .b = x, .c = (void *) 0 };
35 return foo (&y) + 1;
38 int
39 main (void)
41 if (bar (&v) != 13)
42 abort ();
43 exit (0);