Dead
[official-gcc.git] / gomp-20050608-branch / gcc / testsuite / gcc.c-torture / execute / pr20601-1.c
blob7c13c9138193fbd3ac8170fc347ecc0773d8cb90
1 /* PR tree-optimization/20601 */
2 extern void abort (void);
3 extern void exit (int);
5 struct T
7 char *t1;
8 char t2[4096];
9 char **t3;
12 int a[5];
13 int b;
14 char **c;
15 int d;
16 char **e;
17 struct T t;
18 char *f[16];
19 char *g[] = { "a", "-u", "b", "c" };
21 __attribute__ ((__noreturn__)) void
22 foo (void)
24 while (1);
27 __attribute__ ((noinline)) char *
28 bar (char *x, unsigned int y)
30 return 0;
33 static inline char *
34 baz (char *x, unsigned int y)
36 if (sizeof (t.t2) != (unsigned int) -1 && y > sizeof (t.t2))
37 foo ();
38 return bar (x, y);
41 static inline int
42 setup1 (int x)
44 char *p;
45 int rval;
47 if (!baz (t.t2, sizeof (t.t2)))
48 baz (t.t2, sizeof (t.t2));
50 if (x & 0x200)
52 char **h, **i = e;
54 ++d;
55 e = f;
56 if (t.t1 && *t.t1)
57 e[0] = t.t1;
58 else
59 abort ();
61 for (h = e + 1; (*h = *i); ++i, ++h)
64 return 1;
67 static inline int
68 setup2 (void)
70 int j = 1;
72 e = c + 1;
73 d = b - 1;
74 while (d > 0 && e[0][0] == '-')
76 if (e[0][1] != '\0' && e[0][2] != '\0')
77 abort ();
79 switch (e[0][1])
81 case 'u':
82 if (!e[1])
83 abort ();
85 t.t3 = &e[1];
86 d--;
87 e++;
88 break;
89 case 'P':
90 j |= 0x1000;
91 break;
92 case '-':
93 d--;
94 e++;
95 if (j == 1)
96 j |= 0x600;
97 return j;
99 d--;
100 e++;
103 if (d > 0 && !(j & 1))
104 abort ();
106 return j;
110 main (void)
112 int x;
113 c = g;
114 b = 4;
115 x = setup2 ();
116 t.t1 = "/bin/sh";
117 setup1 (x);
118 /* PRE shouldn't transform x into the constant 0x601 here, it's not legal. */
119 if ((x & 0x400) && !a[4])
120 abort ();
121 exit (0);