aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>1999-02-24 11:09:08 +0000
committerZack Weinberg <zack@gcc.gnu.org>1999-02-24 11:09:08 +0000
commitd2ae3ff54e52449707326c83c1286d0928e25817 (patch)
tree96547ef25b3ed64ed50d30848606778ec9d5811d
parentc7b2eb810e47a67616b402f66db0b51601d1d0ad (diff)
downloadgcc-d2ae3ff54e52449707326c83c1286d0928e25817.zip
gcc-d2ae3ff54e52449707326c83c1286d0928e25817.tar.gz
gcc-d2ae3ff54e52449707326c83c1286d0928e25817.tar.bz2
New testcase for cpp, written by Kaveh Ghazi <ghazi@caip.rutgers.edu>
From-SVN: r25398
-rw-r--r--gcc/testsuite/gcc.dg/cpp-if3.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/cpp-if3.c b/gcc/testsuite/gcc.dg/cpp-if3.c
new file mode 100644
index 0000000..2d5b676
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp-if3.c
@@ -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