2009-03-01 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 1 Mar 2009 20:49:14 +0000 (20:49 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 1 Mar 2009 20:49:14 +0000 (20:49 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@144531 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/omp-low.c

index 1365b59..cada14d 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 b7885e6..dce89fa 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);