OSDN Git Service

* gcc.dg/builtins-config.h: Disable C99 runtime testing for
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / pr19633-1.c
1 /* { dg-do run } */
2
3 /* The max-aliased-vops setting is a temporary workaround to avoid the
4    random failures as described in PR 30194.  This test case does not
5    need alias sets bigger than 13 elements.  */
6 /* { dg-options "-O2 --param max-aliased-vops=15" } */
7
8 extern void abort (void);
9
10 struct S
11 {
12   int w, x, y, z;
13 };
14
15 struct T
16 {
17   int r;
18   struct S s;
19 };
20
21 struct S bar (struct S x, struct S *y)
22 {
23   y->w = 4;
24   return *y;
25 }
26
27 void
28 foo (int a, struct T b)
29 {
30   struct S x;
31   struct S *c = &x;
32   if (a)
33     c = &b.s;
34   b.s.w = 3;
35   /* This call should be marked as clobbering 'x' and 'b'.  */
36   *c = bar (*c, c);
37   if (b.s.w == 3)
38     abort ();
39 }
40
41 float Y;
42
43 struct S bar1 (struct S x, struct S y)
44 {
45   Y = 4;
46   return x;
47 }
48
49 void
50 foo1 (int a, struct T b)
51 {
52   struct S x;
53   struct S *c = &x;
54   float z, *k = &z;
55   if (a)
56     c = &b.s;
57   b.s.w = 3;
58   /* This call should NOT be marked as clobbering 'x' and 'b'.  */
59   x = bar1 (*c, *c);
60   if (b.s.w != 3)
61     link_error ();
62 }
63
64 int main ()
65 {
66   struct T b;
67   foo (3, b);
68   foo1 (3, b);
69   return 0;
70 }