diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-28 10:00:55 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-28 10:00:55 +0000 |
commit | 4e62d878778233548fdf5049e7a2b621b88928ee (patch) | |
tree | 218aa8d29f5907f93670f6494b5c844f7b4bd278 /gcc/testsuite/gcc.dg/alias-9.c | |
parent | 29f9683a5f2242786773eaa8f066001a39f18c82 (diff) | |
download | gcc-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.c | 20 |
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" } */ +} |