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]

[PATCH] Fix PR52329


This fixes PR52329 and avoids invalid MEM_REFs to be passed to
RTL expansion.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2012-02-22  Richard Guenther  <rguenther@suse.de>

	PR middle-end/52329
	* gimple-fold.c (fold_stmt_1): Also canonicalize ADDR_EXPRs
	for GIMPLE_DEBUG stmts.

Index: gcc/gimple-fold.c
===================================================================
--- gcc/gimple-fold.c	(revision 184460)
+++ gcc/gimple-fold.c	(working copy)
@@ -1250,6 +1250,18 @@ fold_stmt_1 (gimple_stmt_iterator *gsi,
 		  changed = true;
 		}
 	    }
+	  else if (val
+		   && TREE_CODE (val) == ADDR_EXPR)
+	    {
+	      tree ref = TREE_OPERAND (val, 0);
+	      tree tem = maybe_fold_reference (ref, false);
+	      if (tem)
+		{
+		  tem = build_fold_addr_expr_with_type (tem, TREE_TYPE (val));
+		  gimple_debug_bind_set_value (stmt, tem);
+		  changed = true;
+		}
+	    }
 	}
       break;
 


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