Merge -r 127928:132243 from trunk
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / pr33848.c
blobc3b85e9e576b88b65c0913f4b827720d5e27a0b8
1 /* &&foo should be hoisted, but on most targets, excess register pressure
2 forces it to be rematerialized before "data != &&foo". On targets that
3 have a "branch if registers are equal" instruction, this leads to the
4 branch having two LABEL_REFs: one for the branch target and one for
5 &&foo. When reloading &&foo into a register, reload would wrongly
6 say that &&foo was the target of the branch, and the real target would
7 then be removed as dead. */
8 /* { dg-do link } */
9 #define NVARS 30
10 #define MULTI(X) \
11 X( 0), X( 1), X( 2), X( 3), X( 4), X( 5), X( 6), X( 7), X( 8), X( 9), \
12 X(10), X(11), X(12), X(13), X(14), X(15), X(16), X(17), X(18), X(19), \
13 X(20), X(21), X(22), X(23), X(24), X(25), X(26), X(27), X(28), X(29)
15 #define DECLARE(INDEX) i##INDEX = gv[INDEX]
16 #define COPY(INDEX) gv[INDEX] = i##INDEX
18 volatile int gv[NVARS];
19 void *volatile data;
21 int
22 main (void)
24 __label__ foo;
26 if (gv[0] == 1)
27 goto foo;
28 data = &&foo;
31 int MULTI (DECLARE);
32 MULTI (COPY);
33 MULTI (COPY);
34 MULTI (COPY);
35 if (data != &&foo)
36 gv[0] = 1;
37 else
38 gv[1] = 2;
40 while (gv[0] > 0);
41 foo:
42 return 0;