aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/cpp/expr-overflow-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/cpp/expr-overflow-1.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/expr-overflow-1.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/cpp/expr-overflow-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/expr-overflow-1.c
new file mode 100644
index 000000000..8a67aaa6d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/expr-overflow-1.c
@@ -0,0 +1,44 @@
+/* Test overflow in preprocessor arithmetic. PR 55715. */
+/* { dg-do preprocess } */
+/* { dg-options "-std=c99" } */
+
+#include <stdint.h>
+
+#if -1 - INTMAX_MIN
+#endif
+
+#if 0 - INTMAX_MIN /* { dg-warning "overflow" } */
+#endif
+
+#if 1 * INTMAX_MIN
+#endif
+
+#if -1 * INTMAX_MIN /* { dg-warning "overflow" } */
+#endif
+
+#if 0 * INTMAX_MIN
+#endif
+
+#if -INTMAX_MIN /* { dg-warning "overflow" } */
+#endif
+
+#if +INTMAX_MIN
+#endif
+
+#if INTMAX_MIN / 1
+#endif
+
+#if INTMAX_MIN / -1 /* { dg-warning "overflow" } */
+#endif
+
+#if UINTMAX_MAX * UINTMAX_MAX
+#endif
+
+#if UINTMAX_MAX / -1
+#endif
+
+#if UINTMAX_MAX + INTMAX_MAX
+#endif
+
+#if UINTMAX_MAX - INTMAX_MIN
+#endif