OSDN Git Service

Missed testcases in earlier commit.
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Jan 2008 14:19:01 +0000 (14:19 +0000)
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Jan 2008 14:19:01 +0000 (14:19 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131722 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/g++.dg/warn/Wstrict-aliasing-8.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wstrict-overflow-21.c [new file with mode: 0644]

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 (file)
index 0000000..497565e
--- /dev/null
@@ -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 (file)
index 0000000..57e9465
--- /dev/null
@@ -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;
+}
+