PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20071219-1.c
blobaabf976e111995c076cbbfb69406b6dc357b0812
1 /* PR c++/34459 */
3 extern void abort (void);
4 extern void *memset (void *s, int c, __SIZE_TYPE__ n);
6 struct S
8 char s[25];
9 };
11 struct S *p;
13 void __attribute__((noinline,noclone))
14 foo (struct S *x, int set)
16 int i;
17 for (i = 0; i < sizeof (x->s); ++i)
18 if (x->s[i] != 0)
19 abort ();
20 else if (set)
21 x->s[i] = set;
22 p = x;
25 void __attribute__((noinline,noclone))
26 test1 (void)
28 struct S a;
29 memset (&a.s, '\0', sizeof (a.s));
30 foo (&a, 0);
31 struct S b = a;
32 foo (&b, 1);
33 b = a;
34 b = b;
35 foo (&b, 0);
38 void __attribute__((noinline,noclone))
39 test2 (void)
41 struct S a;
42 memset (&a.s, '\0', sizeof (a.s));
43 foo (&a, 0);
44 struct S b = a;
45 foo (&b, 1);
46 b = a;
47 b = *p;
48 foo (&b, 0);
51 void __attribute__((noinline,noclone))
52 test3 (void)
54 struct S a;
55 memset (&a.s, '\0', sizeof (a.s));
56 foo (&a, 0);
57 struct S b = a;
58 foo (&b, 1);
59 *p = a;
60 *p = b;
61 foo (&b, 0);
64 int
65 main (void)
67 test1 ();
68 test2 ();
69 test3 ();
70 return 0;