[PR77719] Fix ICE in pp_string, at pretty-print.c:955

Message ID cd8ddafe-fc17-d083-f730-6497fad6aa1e@linaro.org
State New
Headers show

Commit Message

kugan Sept. 24, 2016, 6:50 p.m.
Hi,

In make_new_ssa_for_def (tree-reassoc.c) we should use gimple_get_lhs to 
get lhs instead of gimple_assign_lhs as stmt can be builtins too. 
Attached patch fixes this.

Testcase from PR (attached) seems to fail. I dont any fortran so I didnt 
try fixing it. Any help here is appreciate. The log is:

Executing on host: 
/home/kugan.vivekanandarajah/build/gcc/testsuite/gfortran/../../gfortran 
-B/home/kugan.vivekanandarajah/build/gcc/testsuite/gfortran/../../ 
-B/home/kugan.vivekanandarajah/build/x86_64-pc-linux-gnu/./libgfortran/ 
/home/kugan.vivekanandarajah/gcc/gcc/testsuite/gfortran.dg/pr77719.f90 
-fno-diagnostics-show-caret -fdiagnostics-color=never    -O  -O3 
-ffast-math -S   -o pr77719.s    (timeout = 300)
spawn 
/home/kugan.vivekanandarajah/build/gcc/testsuite/gfortran/../../gfortran 
-B/home/kugan.vivekanandarajah/build/gcc/testsuite/gfortran/../../ 
-B/home/kugan.vivekanandarajah/build/x86_64-pc-linux-gnu/./libgfortran/ 
/home/kugan.vivekanandarajah/gcc/gcc/testsuite/gfortran.dg/pr77719.f90 
-fno-diagnostics-show-caret -fdiagnostics-color=never -O -O3 -ffast-math 
-S -o pr77719.s^M
/home/kugan.vivekanandarajah/gcc/gcc/testsuite/gfortran.dg/pr77719.f90:11:23: 
Warning: Deleted feature: End expression in DO loop at (1) must be integer^M
output is:
/home/kugan.vivekanandarajah/gcc/gcc/testsuite/gfortran.dg/pr77719.f90:11:23: 
Warning: Deleted feature: End expression in DO loop at (1) must be integer^M

FAIL: gfortran.dg/pr77719.f90   -O  (test for excess errors)
Excess errors:

I didn't add it due to this. I will leave it to someone else.

Bootstrapped and regression tested the attached patch on 
x86_64-linux-gnu with no new regressions.

Is this OK for trunk?

Thanks,
Kugan


gcc/ChangeLog:

2016-09-24  Kugan Vivekanandarajah  <kuganv@linaro.org>

	* tree-ssa-reassoc.c (make_new_ssa_for_def): Use gimple_get_lhs to get lhs
	instead of gimple_assign_lhs as stmt can be builtins too.

Patch hide | download patch | download mbox

diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 8fc76e4..d94ff70 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -1158,7 +1158,7 @@  make_new_ssa_for_def (gimple *stmt)
   use_operand_p use;
   imm_use_iterator iter;
   tree new_lhs;
-  tree lhs = gimple_assign_lhs (stmt);
+  tree lhs = gimple_get_lhs (stmt);
 
   new_lhs = make_ssa_name (TREE_TYPE (lhs));
   gimple_set_lhs (stmt, new_lhs);