summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/20020219-1.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/20020219-1.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/20020219-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/20020219-1.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/20020219-1.c b/gcc/testsuite/gcc.dg/20020219-1.c
new file mode 100644
index 000000000..36649490e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20020219-1.c
@@ -0,0 +1,47 @@
+/* PR c/4389
+ This testcase failed because host_integerp (x, 0) was returning
+ 1 even for constants bigger than 2^31. It fails under under hppa
+ hpux without -mdisable-indexing because the pointer x - 1 is used
+ as the base address of an indexed load. Because the struct A is not
+ actually allocated, x - 1 lies in the text segment and this causes
+ the wrong space register to be selected for the load. It fails on
+ IA64 hpux in ILP32 mode because extending x - 1 before adding the
+ array offset gives a different answer then adding first and then
+ extending. The underlying problem is the same as with hppa, x - 1 is
+ not a legal data address. */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-options "-O2 -mdisable-indexing" { target hppa*-*-hpux* } } */
+/* { dg-skip-if "" { "ia64-*-hpux*" } "*" "-mlp64" } */
+
+/* Disable the test entirely for 16-bit targets. */
+#if __INT_MAX__ > 32767
+
+extern void abort (void);
+extern void exit (int);
+struct A {
+ int a[10000][10000];
+};
+int b[2] = { 213151, 0 };
+
+void foo (struct A *x, int y)
+{
+ if (x->a[9999][9999] != x->a[y][y])
+ abort ();
+ if (x->a[9999][9999] != 213151)
+ abort ();
+}
+
+int main (void)
+{
+ struct A *x;
+ asm ("" : "=r" (x) : "0" (&b[1]));
+ foo (x - 1, 9999);
+ exit (0);
+}
+
+#else
+
+int main () { return 0; }
+
+#endif /* __INT_MAX__ */