]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/44632 (wrong code for complex division)
authorRichard Guenther <rguenther@suse.de>
Mon, 9 Aug 2010 13:18:08 +0000 (13:18 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 9 Aug 2010 13:18:08 +0000 (13:18 +0000)
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.

* g++.dg/opt/nrv17.C: New testcase.

From-SVN: r163031

gcc/ChangeLog
gcc/function.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/nrv17.C [new file with mode: 0644]

index ace409d7e7b2a23c2afbba18eb1b30b365d42f4d..eea2550d4a77e93a92be05b45878bb8f21784a96 100644 (file)
@@ -1,3 +1,9 @@
+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
index e89a5c9b78d15694551865ec0ef8ad2c732a599b..a540d059a86df44890f95eba0354bdafd4046b86 100644 (file)
@@ -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
                {
index 4455729fe4a86444409384191d53995f5e0563d2..93ed62f12c0e2947da087b48caae63d61517ac2d 100644 (file)
@@ -1,3 +1,8 @@
+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
diff --git a/gcc/testsuite/g++.dg/opt/nrv17.C b/gcc/testsuite/g++.dg/opt/nrv17.C
new file mode 100644 (file)
index 0000000..6248bca
--- /dev/null
@@ -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;
+}