OSDN Git Service

* lib/gcc-dg.exp (dg-skip-if): New function.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / ultrasp4.c
index b421688..1c72d06 100644 (file)
@@ -1,13 +1,21 @@
 /* Simplified from PR target/5309.  */
 /* { dg-do compile } */
 /* { dg-options "-O2" } */
-/* { dg-options "-O2 -m64 -mcpu=ultrasparc" { target sparc64-*-* } } */
-/* { dg-options "-O2 -m64 -mcpu=ultrasparc" { target sparcv9-*-* } } */
-/* { dg-options "-O2" { target sparc-*-solaris2.[0-6] } } */
-/* { dg-options "-O2" { target sparc-*-solaris2.[0-6].* } } */
+/* { dg-options "-O2 -mcpu=ultrasparc" { target sparc64-*-* sparcv9-*-* } } */
 
-long bar (unsigned int);
-long foo (long x, unsigned int y)
+#if __INT_MAX__ > 32767
+#define PTR_TYPE long
+#else
+/* For 16-bit ports a long is a 32-bit quantity.  So you cannot
+   cast a 32-bit long integer into a pointer which will only be
+   16-bits long.  */
+#define PTR_TYPE int
+#endif
+
+extern PTR_TYPE bar (unsigned int);
+
+PTR_TYPE
+foo (PTR_TYPE x, unsigned int y)
 {
-  return *(((long *) (bar (y) - 1)) + 1 + (x >> 2) % 359);
+  return *(((PTR_TYPE *) (bar (y) - 1)) + 1 + (x >> 2) % 359);
 }