PATCH: testsuite/24962: Fix gcc.target/ia64/20030811-1.c on HP-UX

Steve Ellcey sje@cup.hp.com
Thu Jan 19 19:40:00 GMT 2006


I think this qualifies as obvious so I will check it in tomorrow if
there are no objections.  The problem is that the test assumes that long
is 64 bits.  This is true on IA64 Linux and on HP-UX when in 64 bit
mode, but HP-UX also supports a 32 bit mode where long is only 32 bits
and the test fails when in that mode.

By changing 'unsigned long' to 'unsigned long long', which is 64 bits on
all IA64 platforms in all modes, the test passes on HP-UX and Linux.  I
also used the 'LL' suffix on the 64 bit constants to make them 'long
long'.

Tested on IA64 HP-UX and Linux.

Steve Ellcey
sje@cup.hp.com


Testsuite ChnageLog:

2006-01-19  Steve Ellcey  <sje@cup.hp.com>

	PR testsuite/24962
	* gcc.target/ia64/20030811-1.c: Change 'long' to 'long long'.


Index: gcc.target/ia64/20030811-1.c
===================================================================
--- gcc.target/ia64/20030811-1.c	(revision 109860)
+++ gcc.target/ia64/20030811-1.c	(working copy)
@@ -2,23 +2,23 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -frename-registers" } */
 
-static inline unsigned long
+static inline unsigned long long
 foo (void)
 {
-  unsigned long x;
+  unsigned long long x;
   __asm__ __volatile__ ("" : "=r" (x) :: "memory");
   return x;
 }
 
 static inline void
-bar (unsigned long x, unsigned long y)
+bar (unsigned long long x, unsigned long long y)
 {
   __asm__ __volatile__ ("" :: "r"(x), "r"(y) : "memory");
 }
 
 static inline void
-baz (unsigned long x, unsigned long y, unsigned long z, unsigned long p,
-     unsigned long q)
+baz (unsigned long long x, unsigned long long y, unsigned long long z,
+     unsigned long long p, unsigned long long q)
 {
   __asm__ __volatile__ ("" :: "r" (q << 2) : "memory");
   __asm__ __volatile__ ("" :: "r" (z) : "memory");
@@ -28,10 +28,10 @@ baz (unsigned long x, unsigned long y, u
     __asm__ __volatile__ ("" :: "r" (y), "r" (p) : "memory");
 }
 
-static inline unsigned long
-ffz (unsigned long x)
+static inline unsigned long long
+ffz (unsigned long long x)
 {
-  unsigned long r;
+  unsigned long long r;
   __asm__ ("" : "=r" (r) : "r" (x & (~x - 1)));
   return r;
 }
@@ -41,19 +41,19 @@ void die (const char *, ...) __attribute
 void
 test (void *x)
 {
-  unsigned long a, c;
+  unsigned long long a, c;
 
   a = foo ();
-  bar (0xc000000000000000, 0x660);
-  bar (0xa00000000000c000, 0x539);
-  baz (2, 1, 0xa000000000008000,
-       ({ unsigned long b;
-	  b = ({ unsigned long d; __asm__ ("" : "=r" (d) : "r" (x)); d; })
-	      + 0x10000000000661;
+  bar (0xc000000000000000LL, 0x660);
+  bar (0xa00000000000c000LL, 0x539);
+  baz (2, 1, 0xa000000000008000LL,
+       ({ unsigned long long b;
+	  b = ({ unsigned long long d; __asm__ ("" : "=r" (d) : "r" (x)); d; })
+	      + 0x10000000000661LL;
 	  b;
 	}),
        14);
-  c = ffz (0x1fffffffffffffff);
+  c = ffz (0x1fffffffffffffffLL);
   if (c < 51 || c > 61)
     die ("die", c - 1);
 }



More information about the Gcc-patches mailing list