diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-01-14 16:45:22 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-01-14 16:45:22 +0000 |
commit | 48d49ced9ecf93fd38853e216745593aa4e80791 (patch) | |
tree | 8fa08c2737a3ac983b265b46753713f8c3d356b3 /gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-pta-1.c | |
parent | 8293dc882e5738603be2c66090a1e2c480166f41 (diff) | |
download | gcc-48d49ced9ecf93fd38853e216745593aa4e80791.tar.gz |
2009-01-14 Richard Guenther <rguenther@suse.de>
PR tree-optimization/38826
PR middle-end/38477
* tree-ssa-structalias.c (emit_alias_warning): Emit the pointer
initialization notes only if we actually emitted a warning.
(intra_create_variable_infos): Add constraints for a result decl
that is passed by hidden reference.
(build_pred_graph): Mark all related variables non-direct on
address-taking.
* gcc.dg/Wstrict-aliasing-bogus-pta-1.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143374 138bc75d-0d04-0410-961f-82ee72b054a4
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.c | 19 |
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; +} |