diff mbox

Fix PR77697

Message ID alpine.LSU.2.11.1609231434470.26629@t29.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Sept. 23, 2016, 12:35 p.m. UTC
As noted in the PR defcodefor_name was quite broken - the following
rectifies it.

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

Richard.

2016-09-23  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/77697
	* tree-ssa-forwprop.c (defcodefor_name): Remove bogus code,
	signal error if we have sth ternary or unhandled.
diff mbox

Patch

Index: gcc/tree-ssa-forwprop.c
===================================================================
--- gcc/tree-ssa-forwprop.c	(revision 240388)
+++ gcc/tree-ssa-forwprop.c	(working copy)
@@ -1458,6 +1458,7 @@  defcodefor_name (tree name, enum tree_co
   code1 = TREE_CODE (name);
   arg11 = name;
   arg21 = NULL_TREE;
+  arg31 = NULL_TREE;
   grhs_class = get_gimple_rhs_class (code1);
 
   if (code1 == SSA_NAME)
@@ -1470,20 +1471,18 @@  defcodefor_name (tree name, enum tree_co
 	  code1 = gimple_assign_rhs_code (def);
 	  arg11 = gimple_assign_rhs1 (def);
           arg21 = gimple_assign_rhs2 (def);
-          arg31 = gimple_assign_rhs2 (def);
+          arg31 = gimple_assign_rhs3 (def);
 	}
     }
-  else if (grhs_class == GIMPLE_TERNARY_RHS
-	   || GIMPLE_BINARY_RHS
-	   || GIMPLE_UNARY_RHS
-	   || GIMPLE_SINGLE_RHS)
-    extract_ops_from_tree (name, &code1, &arg11, &arg21, &arg31);
+  else if (grhs_class != GIMPLE_SINGLE_RHS)
+    code1 = ERROR_MARK;
 
   *code = code1;
   *arg1 = arg11;
   if (arg2)
     *arg2 = arg21;
-  /* Ignore arg3 currently. */
+  if (arg31)
+    *code = ERROR_MARK;
 }