re PR tree-optimization/39331 (OpenMP and return-slot-optimization generate invalid...
authorRichard Guenther <rguenther@suse.de>
Sun, 1 Mar 2009 20:49:14 +0000 (20:49 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sun, 1 Mar 2009 20:49:14 +0000 (20:49 +0000)
2009-03-01  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/39331
* omp-low.c (lower_send_shared_vars): Do not receive new
values for the reference of DECL_BY_REFERENCE parms or results.

From-SVN: r144531

gcc/ChangeLog
gcc/omp-low.c

index 1365b591649cae35ded92d500bcab5da8e79af6e..cada14d8be444e5baa38a05a4e90df658c629ac4 100644 (file)
@@ -1,3 +1,9 @@
+2009-03-01  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/39331
+       * omp-low.c (lower_send_shared_vars): Do not receive new
+       values for the reference of DECL_BY_REFERENCE parms or results.
+
 2009-03-01  Jan Hubicka  <jh@suse.cz>
 
        PR debug/39267
index b7885e6cf3c12a841fda77a1003278a0214a90ad..dce89fa2464125484198a9e2c4c4fb5085825063 100644 (file)
@@ -2821,7 +2821,14 @@ lower_send_shared_vars (gimple_seq *ilist, gimple_seq *olist, omp_context *ctx)
          x = build_sender_ref (ovar, ctx);
          gimplify_assign (x, var, ilist);
 
-         if (!TREE_READONLY (var))
+         if (!TREE_READONLY (var)
+             /* We don't need to receive a new reference to a result
+                or parm decl.  In fact we may not store to it as we will
+                invalidate any pending RSO and generate wrong gimple
+                during inlining.  */
+             && !((TREE_CODE (var) == RESULT_DECL
+                   || TREE_CODE (var) == PARM_DECL)
+                  && DECL_BY_REFERENCE (var)))
            {
              x = build_sender_ref (ovar, ctx);
              gimplify_assign (var, x, olist);