[PATCH] Fix type mismatch in perfect_nestify (PR tree-optimization/39516)
Jakub Jelinek
jakub@redhat.com
Mon Mar 23 13:35:00 GMT 2009
Hi!
GCC ICEs on the attached testcase, because perfect_nestify creates
the uboundvar.* variable with incorrect type (always int).
Fixed thusly, bootstrapped/regtested on x86_64-linux, ok for trunk?
2009-03-23 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/39516
* lambda-code.c (perfect_nestify): Fix type of the uboundvar variable.
* gfortran.dg/pr39516.f: New test.
--- gcc/lambda-code.c.jj 2009-01-13 18:32:17.000000000 +0100
+++ gcc/lambda-code.c 2009-03-23 10:20:52.000000000 +0100
@@ -2472,7 +2472,8 @@ perfect_nestify (struct loop *loop,
it to one just in case. */
exit_condition = get_loop_exit_condition (newloop);
- uboundvar = create_tmp_var (integer_type_node, "uboundvar");
+ uboundvar = create_tmp_var (TREE_TYPE (VEC_index (tree, ubounds, 0)),
+ "uboundvar");
add_referenced_var (uboundvar);
stmt = gimple_build_assign (uboundvar, VEC_index (tree, ubounds, 0));
uboundvar = make_ssa_name (uboundvar, stmt);
--- gcc/testsuite/gfortran.dg/pr39516.f.jj 2009-03-23 10:24:53.000000000 +0100
+++ gcc/testsuite/gfortran.dg/pr39516.f 2009-03-23 09:47:58.000000000 +0100
@@ -0,0 +1,19 @@
+C PR tree-optimization/39516
+C { dg-options "-O2 -ftree-loop-linear" }
+ SUBROUTINE SUB(A, B, M)
+ IMPLICIT NONE
+ DOUBLE PRECISION A(20,20), B(20)
+ INTEGER*8 I, J, K, M
+ DO I=1,M
+ DO J=1,M
+ A(I,J)=A(I,J)+1
+ END DO
+ END DO
+ DO K=1,20
+ DO I=1,M
+ DO J=1,M
+ B(I)=B(I)+A(I,J)
+ END DO
+ END DO
+ END DO
+ END SUBROUTINE
Jakub
More information about the Gcc-patches
mailing list