mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-23 01:30:29 +08:00
New testcase for cpp, written by Kaveh Ghazi <ghazi@caip.rutgers.edu>
From-SVN: r25398
This commit is contained in:
parent
c7b2eb810e
commit
d2ae3ff54e
23
gcc/testsuite/gcc.dg/cpp-if3.c
Normal file
23
gcc/testsuite/gcc.dg/cpp-if3.c
Normal file
@ -0,0 +1,23 @@
|
||||
/* { dg-do preprocess } */
|
||||
/* { dg-options -pedantic-errors } */
|
||||
|
||||
#define U_MAX 4294967295U
|
||||
#define ULL_MAX 18446744073709551615ULL
|
||||
#define LL_MAX 9223372036854775807LL
|
||||
#define LL_MIN (-LL_MAX-1)
|
||||
|
||||
/* Check simple truncation. */
|
||||
#if U_MAX == ULL_MAX || LL_MIN == 0 || LL_MAX == -1
|
||||
#error "simple truncation" /* { dg-bogus "trunc" "simple truncation" } */
|
||||
#endif
|
||||
|
||||
/* Check left/right shifting with all bits set and with one bit set. */
|
||||
#if !(~0ULL >> 63) || !(~0ULL << 63) || !(~0LL >> 63) || !(~0LL << 63) || \
|
||||
!(LL_MIN >> 63) || !(1LL << 63) || !(ULL_MAX >> 63) || !(1ULL << 63)
|
||||
#error "bit shift truncation" /* { dg-bogus "trunc" "bit shift truncation" } */
|
||||
#endif
|
||||
|
||||
/* Check math expressions. */
|
||||
#if (2ULL * U_MAX < U_MAX) || (1ULL + U_MAX < U_MAX)
|
||||
#error "math truncation" /* { dg-bogus "trunc" "math truncation" } */
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user