summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr36227.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr36227.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr36227.c12
1 files changed, 11 insertions, 1 deletions
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;
}
+