diff options
Diffstat (limited to 'gcc')
| -rw-r--r-- | gcc/ChangeLog | 7 | ||||
| -rw-r--r-- | gcc/alias.c | 6 | ||||
| -rw-r--r-- | gcc/testsuite/ChangeLog | 11 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/mayalias-3.c | 27 |
4 files changed, 46 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 05358b1..3cca0dc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2006-11-11 Andrew Pinski <andrew_pinski@playstation.sony.com> + + PR rtl-opt/28812 + * alias.c (fixed_scalar_and_varying_struct_p): Don't return a + non null value if the struct memory access is in the 0th + aliasing set. + 2006-11-12 Jie Zhang <jie.zhang@analog.com> Revert diff --git a/gcc/alias.c b/gcc/alias.c index 7c51ad7..d027b79 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -1857,13 +1857,15 @@ fixed_scalar_and_varying_struct_p (rtx mem1, rtx mem2, rtx mem1_addr, if (! flag_strict_aliasing) return NULL_RTX; - if (MEM_SCALAR_P (mem1) && MEM_IN_STRUCT_P (mem2) + if (MEM_ALIAS_SET (mem2) + && MEM_SCALAR_P (mem1) && MEM_IN_STRUCT_P (mem2) && !varies_p (mem1_addr, 1) && varies_p (mem2_addr, 1)) /* MEM1 is a scalar at a fixed address; MEM2 is a struct at a varying address. */ return mem1; - if (MEM_IN_STRUCT_P (mem1) && MEM_SCALAR_P (mem2) + if (MEM_ALIAS_SET (mem1) + && MEM_IN_STRUCT_P (mem1) && MEM_SCALAR_P (mem2) && varies_p (mem1_addr, 1) && !varies_p (mem2_addr, 1)) /* MEM2 is a scalar at a fixed address; MEM1 is a struct at a varying address. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index be5d63c..525ac64 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-11-11 Andrew Pinski <andrew_pinski@playstation.sony.com> + + PR rtl-opt/28812 + * gcc.c-torture/execute/mayalias-3.c: New test. + 2006-11-11 Richard Sandiford <richard@codesourcery.com> PR middle-end/27528 @@ -12,8 +17,8 @@ 2006-11-10 Paul Thomas <pault@gcc.gnu.org> - PR fortran/29758 - * gfortran.dg/reshape_source_size_1.f90: New test. + PR fortran/29758 + * gfortran.dg/reshape_source_size_1.f90: New test. 2006-11-10 Paul Thomas <pault@gcc.gnu.org> @@ -23,7 +28,7 @@ 2006-11-10 Uros Bizjak <ubizjak@gmail.com> PR target/29777 - * lib/target-supports.exp (vect_widen_mult_hi_to_si): Add i?86-*-* + * lib/target-supports.exp (vect_widen_mult_hi_to_si): Add i?86-*-* and x86_64-*-* targets. 2006-11-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> diff --git a/gcc/testsuite/gcc.c-torture/execute/mayalias-3.c b/gcc/testsuite/gcc.c-torture/execute/mayalias-3.c new file mode 100644 index 0000000..3d66791 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/mayalias-3.c @@ -0,0 +1,27 @@ +struct S { short x; }; +typedef struct S __attribute__((__may_alias__)) test; + +test *p; + +int g(int *a) +{ + p = (test*)a; +} + +int f() +{ + int a; + g(&a); + a = 10; + test s={1}; + *p=s; + return a; +} + +int main() { + if (f() == 10) + __builtin_abort(); + return 0; +} + + |
