OSDN Git Service

* c-tree.h: Add argument to c_objc_common_truthvalue_conversion,
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / pr36227.c
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -Wstrict-overflow=3" } */
3 #if (__SIZEOF_LONG_LONG__ == __SIZEOF_POINTER__)
4 typedef unsigned long long ptrcast;
5 #elif (__SIZEOF_LONG__ == __SIZEOF_POINTER__)
6 typedef unsigned long ptrcast;
7 #elif (__SIZEOF_INT__ == __SIZEOF_POINTER__)
8 typedef unsigned int ptrcast;
9 #else
10 #error Add target support here
11 #endif
12
13 volatile unsigned long *
14 sat_add(volatile unsigned long *ptr, unsigned long i, volatile unsigned long *end)
15 {
16   if ((ptrcast)ptr + i * sizeof(*ptr) > (ptrcast)ptr) /* { dg-bogus "pointer wraparound" } */
17     return ptr + i;
18   else
19     return end;
20 }
21
22