This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gomp] Add missing fold_convert in lower_omp_parallel (PR middle-end/28713)


Hi!

fixup_child_record_type changes the receiver_decl's type for VLAs.
The following patch adds the needed fold_convert and the corresponding
changes in expand_omp_parallel to grok it.
Ok for trunk?

2006-08-15  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/28713
	* omp-low.c (lower_omp_parallel): Convert t to
	receiver_decl's type.
	(expand_omp_parallel): STRIP_NOPS from the MODIFY_EXPR
	source before comparison.

--- gcc/omp-low.c.jj	2006-07-15 16:09:16.000000000 +0200
+++ gcc/omp-low.c	2006-08-15 14:33:17.000000000 +0200
@@ -2475,13 +2475,17 @@ expand_omp_parallel (struct omp_region *
 
 	  for (si = bsi_start (entry_succ_bb); ; bsi_next (&si))
 	    {
-	      tree stmt;
+	      tree stmt, arg;
 
 	      gcc_assert (!bsi_end_p (si));
 	      stmt = bsi_stmt (si);
-	      if (TREE_CODE (stmt) == MODIFY_EXPR
-		  && TREE_CODE (TREE_OPERAND (stmt, 1)) == ADDR_EXPR
-		  && TREE_OPERAND (TREE_OPERAND (stmt, 1), 0)
+	      if (TREE_CODE (stmt) != MODIFY_EXPR)
+		continue;
+
+	      arg = TREE_OPERAND (stmt, 1);
+	      STRIP_NOPS (arg);
+	      if (TREE_CODE (arg) == ADDR_EXPR
+		  && TREE_OPERAND (arg, 0)
 		     == OMP_PARALLEL_DATA_ARG (entry_stmt))
 		{
 		  if (TREE_OPERAND (stmt, 0) == DECL_ARGUMENTS (child_fn))
@@ -4084,6 +4088,8 @@ lower_omp_parallel (tree *stmt_p, omp_co
   if (ctx->record_type)
     {
       t = build_fold_addr_expr (ctx->sender_decl);
+      /* fixup_child_record_type might have changed receiver_decl's type.  */
+      t = fold_convert (TREE_TYPE (ctx->receiver_decl), t);
       t = build2 (MODIFY_EXPR, void_type_node, ctx->receiver_decl, t);
       append_to_statement_list (t, &new_body);
     }

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]