diff options
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/function.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/opt/nrv17.C | 32 |
4 files changed, 46 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ace409d..eea2550 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2010-08-09 Richard Guenther <rguenther@suse.de> + PR middle-end/44632 + * function.c (gimplify_parameters): Do not clear addressable + bit of the original parameter. + +2010-08-09 Richard Guenther <rguenther@suse.de> + PR middle-end/45212 * emit-rtl.c (set_mem_attributes_minus_bitpos): Adjust alignment from MEM_REF offset only if we took it from the diff --git a/gcc/function.c b/gcc/function.c index e89a5c9..a540d05 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -3570,12 +3570,10 @@ gimplify_parameters (void) DECL_IGNORED_P (local) = 0; /* If PARM was addressable, move that flag over to the local copy, as its address will be taken, - not the PARMs. */ + not the PARMs. Keep the parms address taken + as we'll query that flag during gimplification. */ if (TREE_ADDRESSABLE (parm)) - { - TREE_ADDRESSABLE (parm) = 0; - TREE_ADDRESSABLE (local) = 1; - } + TREE_ADDRESSABLE (local) = 1; } else { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4455729..93ed62f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2010-08-09 Richard Guenther <rguenther@suse.de> + PR middle-end/44632 + * g++.dg/opt/nrv17.C: New testcase. + +2010-08-09 Richard Guenther <rguenther@suse.de> + PR middle-end/45212 * emit-rtl.c (set_mem_attributes_minus_bitpos): Adjust alignment from MEM_REF offset only if we took it from the diff --git a/gcc/testsuite/g++.dg/opt/nrv17.C b/gcc/testsuite/g++.dg/opt/nrv17.C new file mode 100644 index 0000000..6248bca --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/nrv17.C @@ -0,0 +1,32 @@ +// { dg-do run } + +#include <cstdlib> +#include <complex> + +void __attribute__((noinline)) +h(std::complex<double> x) +{ + if (x.real() != 2.0) + std::abort (); +} + +void __attribute__((noinline)) +g(std::complex<double> x) +{ + if (x.real() != 0.5) + std::abort (); +} + +void __attribute__((noinline)) +f(std::complex<double> x) +{ + h (x); + x = 1.0 / x; + g (x); +} + +int main() +{ + f(2.0); + return 0; +} |