This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch: PR target/19890 - gcc.dg/20020219-1.c fails on IA64 HP-UX
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 25 Mar 2005 11:31:06 -0800 (PST)
- Subject: Patch: PR target/19890 - gcc.dg/20020219-1.c fails on IA64 HP-UX
- Reply-to: sje at cup dot hp dot com
I think this is an obvious fix so I will check it in if no one objects.
I believe the test is technically illegal C, since "x - 1" is not
pointing at real data. On IA64 HP-UX, in 32 bit mode, this results in
bad code because GCC assumes that extending a pointer (with the IA64
addp4 instruction) and then adding a constant is the same as adding a
constant and then extending it. This is true for any pointer that
actually points to real data but the "x - 1" expression that is passed
in to foo is not pointing at any real data.
Steve Ellcey
sje@cup.hp.com
2005-03-25 Steve Ellcey <sje@cup.hp.com>
PR target/19890
* gcc.dg/20020219-1.c: Skip on IA64 HP-UX in ILP32 mode.
*** gcc.orig/gcc/testsuite/gcc.dg/20020219-1.c Fri Mar 25 11:17:46 2005
--- gcc/gcc/testsuite/gcc.dg/20020219-1.c Fri Mar 25 11:17:30 2005
***************
*** 1,13 ****
/* 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 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. */
/* { dg-do run } */
/* { dg-options "-O2" } */
/* { dg-options "-O2 -mdisable-indexing" { target hppa*-*-hpux* } } */
/* Disable the test entirely for 16-bit targets. */
#if __INT_MAX__ > 32767
--- 1,18 ----
/* 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