aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8/gcc/testsuite/gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.8/gcc/testsuite/gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c')
-rw-r--r--gcc-4.8/gcc/testsuite/gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c b/gcc-4.8/gcc/testsuite/gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c
new file mode 100644
index 000000000..b90fb76c2
--- /dev/null
+++ b/gcc-4.8/gcc/testsuite/gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wstrict-aliasing -fstrict-aliasing" } */
+
+extern int flag;
+
+int foo() {
+
+ int x;
+ int y = 9;
+ float* q;
+ float* r;
+
+ if (flag) {
+ q = (float*) &x; /* { dg-message "initialized" "" { xfail *-*-* } } */
+ } else {
+ q = (float*) &y; /* { dg-message "initialized" "" { xfail *-*-* } } */
+ }
+
+ *q = 1.0; /* { dg-warning "does break strict-aliasing" "" { xfail *-*-* } } */
+
+ return x;
+
+}