summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/alias-9.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-28 10:00:55 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-28 10:00:55 +0000
commit4e62d878778233548fdf5049e7a2b621b88928ee (patch)
tree218aa8d29f5907f93670f6494b5c844f7b4bd278 /gcc/testsuite/gcc.dg/alias-9.c
parent29f9683a5f2242786773eaa8f066001a39f18c82 (diff)
downloadgcc-4e62d878778233548fdf5049e7a2b621b88928ee.tar.gz
2005-11-28 Richard Guenther <rguenther@suse.de>
* c-common.c (strict_aliasing_warning): Handle all component-ref like accesses. * gcc.dg/alias-9.c: New testcase. * g++.dg/warn/Wstrict-aliasing-7.C: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107598 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/alias-9.c')
-rw-r--r--gcc/testsuite/gcc.dg/alias-9.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/alias-9.c b/gcc/testsuite/gcc.dg/alias-9.c
new file mode 100644
index 00000000000..6e9d4a83e35
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/alias-9.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-Wstrict-aliasing -O2" } */
+
+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 x;
+int *bar(void)
+{
+ return (int *)&__imag x; /* { dg-warning "strict-aliasing" } */
+}