aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/undefined-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/c-c++-common/ubsan/undefined-2.c')
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/undefined-2.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/undefined-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/undefined-2.c
new file mode 100644
index 000000000..fd5b4d3e9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/undefined-2.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=undefined" } */
+/* { dg-additional-options "-std=gnu11" { target c } } */
+/* { dg-additional-options "-std=c++11" { target c++ } } */
+
+#include <stdio.h>
+
+volatile int w, z;
+
+__attribute__ ((noinline, noclone)) int
+foo (int x, int y)
+{
+ z++;
+ return x << y;
+}
+
+int
+main ()
+{
+ fputs ("1st\n", stderr);
+ w = foo (0, -__INT_MAX__);
+ return 0;
+}
+
+/* { dg-output "1st(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*shift exponent -\[^\n\r]* is negative\[^\n\r]*(\n|\r\n|\r)" } */