summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-pta-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-pta-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-pta-1.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-pta-1.c b/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-pta-1.c
new file mode 100644
index 00000000000..a48827474d7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-pta-1.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wall" } */
+
+struct S { int *p; int *q; };
+
+void foo (struct S *);
+
+int bar (int b)
+{
+ struct S s;
+ int *p;
+ float f;
+ foo (&s);
+ if (b)
+ p = s.q;
+ else
+ p = (int *)&f;
+ return *p;
+}