summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhutchinsonandy <hutchinsonandy@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-02 22:24:18 +0000
committerhutchinsonandy <hutchinsonandy@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-02 22:24:18 +0000
commit413528da044e112e81a587be998e35b679778abb (patch)
tree4c8f2e1118a71ce6a83d130180f7b5ea4c0ab4fb
parent3567560c9ca0fb619df1e256a7dcbc556f1affff (diff)
downloadppe42-gcc-413528da044e112e81a587be998e35b679778abb.tar.gz
ppe42-gcc-413528da044e112e81a587be998e35b679778abb.zip
* gcc.dg/pr36227.c: Correct test for targets where long is not the same size as pointer.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137395 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr36227.c12
2 files changed, 16 insertions, 1 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d7ef19ff58b..6cf1443fb6f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-02 Andy Hutchinson <hutchinsonandy@aim.com>
+
+ * gcc.dg/pr36227.c: Correct test for targets where long is
+ not the same size as pointer.
+
2008-07-02 Kaz Kojima <kkojima@gcc.gnu.org>
* g++.dg/cdce3.C: Test long double math functions for
diff --git a/gcc/testsuite/gcc.dg/pr36227.c b/gcc/testsuite/gcc.dg/pr36227.c
index d6657632b91..27fe0015505 100644
--- a/gcc/testsuite/gcc.dg/pr36227.c
+++ b/gcc/testsuite/gcc.dg/pr36227.c
@@ -1,12 +1,22 @@
/* { dg-do compile } */
/* { dg-options "-O2 -Wstrict-overflow=3" } */
+#if (__SIZEOF_LONG_LONG__ == __SIZEOF_POINTER__)
+typedef unsigned long long ptrcast;
+#elif (__SIZEOF_LONG__ == __SIZEOF_POINTER__)
+typedef unsigned long ptrcast;
+#elif (__SIZEOF_INT__ == __SIZEOF_POINTER__)
+typedef unsigned int ptrcast;
+#else
+#error Add target support here
+#endif
volatile unsigned long *
sat_add(volatile unsigned long *ptr, unsigned long i, volatile unsigned long *end)
{
- if ((unsigned long)ptr + i * sizeof(*ptr) > (unsigned long)ptr) /* { dg-bogus "pointer wraparound" } */
+ if ((ptrcast)ptr + i * sizeof(*ptr) > (ptrcast)ptr) /* { dg-bogus "pointer wraparound" } */
return ptr + i;
else
return end;
}
+
OpenPOWER on IntegriCloud