svn merge -r102224:107263 svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-3_4-branch
[official-gcc.git] / gcc / testsuite / gcc.dg / 20020219-1.c
bloba3cda0e65d6f4e6dec6fa888df3110730ea89ce4
1 /* PR c/4389
2 This testcase failed because host_integerp (x, 0) was returning
3 1 even for constants bigger than 2^31. It fails under under hpux
4 without -mdisable-indexing because the pointer x - 1 is used as
5 the base address of an indexed load. Because the struct A is not
6 actually allocated, x - 1 lies in the text segment and this causes
7 the wrong space register to be selected for the load. */
8 /* { dg-do run } */
9 /* { dg-options "-O2" } */
10 /* { dg-options "-O2 -mdisable-indexing" { target hppa*-*-hpux* } } */
12 /* Disable the test entirely for 16-bit targets. */
13 #if __INT_MAX__ > 32767
15 extern void abort (void);
16 extern void exit (int);
17 struct A {
18 int a[10000][10000];
20 int b[2] = { 213151, 0 };
22 void foo (struct A *x, int y)
24 if (x->a[9999][9999] != x->a[y][y])
25 abort ();
26 if (x->a[9999][9999] != 213151)
27 abort ();
30 int main (void)
32 struct A *x;
33 asm ("" : "=r" (x) : "0" (&b[1]));
34 foo (x - 1, 9999);
35 exit (0);
38 #else
40 int main () { return 0; }
42 #endif /* __INT_MAX__ */