Fix PR85082

Message ID alpine.LSU.2.20.1803271344160.18265@zhemvz.fhfr.qr
State New
Headers show
Series
  • Fix PR85082
Related show

Commit Message

Richard Biener March 27, 2018, 11:45 a.m.
From the alias-oracle walk we don't get here with valueized VUSE
so valueize it before looking up an existing value, otherwise
we'll ICE upon insertion which does valueize.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2018-03-27  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/85082
	* tree-ssa-sccvn.c (vn_reference_lookup_or_insert_for_pieces):
	Valueize the VUSE.

	* gfortran.dg/pr85082.f90: New testcase.

Patch

Index: gcc/tree-ssa-sccvn.c
===================================================================
--- gcc/tree-ssa-sccvn.c	(revision 258851)
+++ gcc/tree-ssa-sccvn.c	(working copy)
@@ -1631,7 +1631,7 @@  vn_reference_lookup_or_insert_for_pieces
   vn_reference_s vr1;
   vn_reference_t result;
   unsigned value_id;
-  vr1.vuse = vuse;
+  vr1.vuse = vuse ? SSA_VAL (vuse) : NULL_TREE;
   vr1.operands = operands;
   vr1.type = type;
   vr1.set = set;
Index: gcc/testsuite/gfortran.dg/pr85082.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr85082.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/pr85082.f90	(working copy)
@@ -0,0 +1,14 @@ 
+! { dg-do compile }
+! { dg-options "-Ofast" }
+program p
+   real(4) :: a, b
+   integer(4) :: n, m
+   equivalence (a, n)
+   a = 1024.0
+   m = 8
+   a = 1024.0
+   b = set_exponent(a, m)
+   n = 8
+   a = f(a, n)
+   b = set_exponent(a, m)
+end