OSDN Git Service

* lib/gcc-dg.exp (dg-skip-if): New function.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / ultrasp4.c
index 6cd08b2..1c72d06 100644 (file)
@@ -3,8 +3,19 @@
 /* { dg-options "-O2" } */
 /* { 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);
 }