Tighten condition in vect/pr85586.c (PR 85654)
[official-gcc.git] / gcc / testsuite / gcc.dg / 20020312-2.c
blobf5929e0b05711e8379a0f4f6528e9b75536f8563
1 /* PR 5878.
3 We ICEd in verify_local_live_at_start because we incorrectly forced
4 the PIC register live between BAR and BAZ. We did this because the
5 definition of PIC_OFFSET_TABLE_REGNUM was incorrectly not INVALID_REGNUM
6 when !flag_pic for most targets. */
8 /* { dg-do run } */
9 /* { dg-options "-O -fno-pic" } */
10 /* { dg-require-effective-target nonlocal_goto } */
12 extern void abort (void);
14 #if defined(__alpha__)
15 /* PIC register is $29, but is used even without -fpic. */
16 #elif defined(__arc__)
17 # define PIC_REG "26"
18 #elif defined(__arm__)
19 # define PIC_REG "9"
20 #elif defined(AVR)
21 /* No pic register. */
22 #elif defined(__cris__)
23 # define PIC_REG "0"
24 #elif defined(__epiphany__)
25 #define PIC_REG "r28"
26 #elif defined(__fr30__)
27 /* No pic register. */
28 #elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__)
29 /* No pic register. */
30 #elif defined(_IBMR2)
31 /* No pic register. */
32 #elif defined(__i386__)
33 # define PIC_REG "ebx"
34 #elif defined(__ia64__)
35 /* PIC register is r1, but is used even without -fpic. */
36 #elif defined(__lm32__)
37 /* No pic register. */
38 #elif defined(__M32R__)
39 /* No pic register. */
40 #elif defined(__m68k__)
41 # define PIC_REG "a5"
42 #elif defined(__mc68hc1x__)
43 /* No pic register. */
44 #elif defined(__mcore__)
45 /* No pic register. */
46 #elif defined(__MICROBLAZE__)
47 # define PIC_REG "r20"
48 #elif defined(__mips__)
49 /* PIC register is $28, but is used even without -fpic. */
50 #elif defined(__MMIX__)
51 /* No pic register. */
52 #elif defined(__mn10300__)
53 /* No pic register. */
54 #elif defined(__moxie__)
55 /* No pic register. */
56 #elif defined(__nds32__)
57 /* No pic register. */
58 #elif defined(__nios2__)
59 /* No pic register. */
60 #elif defined(__hppa__)
61 /* PIC register is %r27 or %r19, but is used even without -fpic. */
62 #elif defined(__pdp11__)
63 /* No pic register. */
64 #elif defined(__powerpc__) || defined(__PPC__) || defined(__POWERPC__) || defined (__ppc)
65 # ifdef __MACH__
66 # define PIC_REG "31"
67 # else
68 # define PIC_REG "30"
69 # endif
70 #elif defined(__riscv)
71 /* No pic register. */
72 #elif defined(__RX__)
73 /* No pic register. */
74 #elif defined(__s390__)
75 # define PIC_REG "12"
76 #elif defined(__sparc__)
77 # define PIC_REG "l7"
78 #elif defined(__tile__)
79 # define PIC_REG "r51"
80 #elif defined(__TMS320C6X__)
81 # define PIC_REG "B14"
82 #elif defined(__v850)
83 /* No pic register. */
84 #elif defined(__vax__)
85 /* No pic register. */
86 #elif defined(__VISIUM__)
87 /* No pic register. */
88 #elif defined(__xstormy16__)
89 /* No pic register. */
90 #elif defined(__XTENSA__)
91 /* No pic register. */
92 #elif defined(__sh__)
93 # define PIC_REG "r12"
94 #elif defined(__x86_64__)
95 /* No pic register. */
96 #elif defined(__m32c__)
97 /* No pic register. */
98 #elif defined(__SPU__)
99 # define PIC_REG "126"
100 #elif defined (__frv__)
101 # ifdef __FRV_FDPIC__
102 # define PIC_REG "gr15"
103 # else
104 # define PIC_REG "gr17"
105 #endif
106 #elif defined (__aarch64__)
107 /* No pic register -- yet. */
108 #elif defined(__RL78__)
109 /* No pic register. */
110 #elif defined(__MSP430__)
111 /* No pic register. */
112 #elif defined (__nvptx__)
113 /* No pic register. */
114 #else
115 # error "Modify the test for your target."
116 #endif
118 #if defined PIC_REG && !defined __PIC__ && !defined __pic__
119 register void *reg __asm__(PIC_REG);
120 #else
121 /* We really need a global register variable set to the PIC register
122 to expose the bug. Oh well, let the test case not fail. */
123 static void *reg;
124 #endif
126 void * __attribute__((noinline))
127 dummy (void *x)
129 return x;
132 void
133 f (void)
135 goto *dummy (&&bar);
136 for (;;)
138 foo:
139 reg = (void *) 1;
140 if (!reg)
141 goto baz;
142 reg = &&foo;
145 bar:
146 baz:
147 reg = 0;
151 main()
153 void *old_reg = reg;
154 reg = (void *) 1;
156 f ();
158 /* Additionally test that the prologue/epilogue properly does *not*
159 save and restore global registers. Not possible when the PIC
160 register is in a register window, of course. On Darwin, you can't
161 call library routines from non-PIC code. */
162 #if !defined (__sparc__) && !defined(__MACH__)
163 if (reg)
164 abort ();
165 #endif
167 reg = old_reg;
168 return 0;