aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2008-01-22 14:19:01 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2008-01-22 14:19:01 +0000
commit573fe0a122594bf28337f9d2d99c8005f1113940 (patch)
treeed1e99ee00340e8745c29bc016ce422c6c2a0c7c /gcc
parent230a3572429c6a844a774ff816b63b049c0e739c (diff)
downloadgcc-573fe0a122594bf28337f9d2d99c8005f1113940.zip
gcc-573fe0a122594bf28337f9d2d99c8005f1113940.tar.gz
gcc-573fe0a122594bf28337f9d2d99c8005f1113940.tar.bz2
Missed testcases in earlier commit.
2008-01-22 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 32102 testsuite/ * gcc.dg/Wstrict-overflow-21.c: New. * g++.dg/warn/Wstrict-aliasing-8.C: New. From-SVN: r131722
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/g++.dg/warn/Wstrict-aliasing-8.C20
-rw-r--r--gcc/testsuite/gcc.dg/Wstrict-overflow-21.c12
2 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-8.C b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-8.C
new file mode 100644
index 0000000..497565e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-8.C
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-Wstrict-aliasing=2 -O2 -Wall" } */
+
+int a[2];
+
+double *foo1(void)
+{
+ return (double *)a; /* { dg-warning "strict-aliasing" } */
+}
+
+double *foo2(void)
+{
+ return (double *)&a[0]; /* { dg-warning "strict-aliasing" } */
+}
+
+__complex__ double x;
+int *bar(void)
+{
+ return (int *)&__imag__ x; /* { dg-warning "strict-aliasing" } */
+}
diff --git a/gcc/testsuite/gcc.dg/Wstrict-overflow-21.c b/gcc/testsuite/gcc.dg/Wstrict-overflow-21.c
new file mode 100644
index 0000000..57e9465
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstrict-overflow-21.c
@@ -0,0 +1,12 @@
+/* PR 32102: -Wall stomps on -Wstrict-overflow */
+/* { dg-do compile } */
+/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow=2 -Wall" } */
+int
+foo ()
+{
+ int i, bits;
+ for (i = 1, bits = 1; i > 0; i += i) /* { dg-warning "assuming signed overflow does not occur" "correct warning" } */
+ ++bits;
+ return bits;
+}
+