OSDN Git Service

2009-08-18 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / torture / pr33848.c
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)
14
15 #define DECLARE(INDEX) i##INDEX = gv[INDEX]
16 #define COPY(INDEX) gv[INDEX] = i##INDEX
17
18 volatile int gv[NVARS];
19 void *volatile data;
20
21 int
22 main (void)
23 {
24   __label__ foo;
25
26   if (gv[0] == 1)
27     goto foo;
28   data = &&foo;
29   do
30     {
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;
39     }
40   while (gv[0] > 0);
41  foo:
42   return 0;
43 }