Patchwork [Fortran,committed] PR51302 - fix ICE with volatile loop variable

login
register
mail settings
Submitter Tobias Burnus
Date Nov. 25, 2011, 3:19 p.m.
Message ID <4ECFB21C.3080600@net-b.de>
Download mbox | patch
Permalink /patch/127711/
State New
Headers show

Comments

Tobias Burnus - Nov. 25, 2011, 3:19 p.m.
Fixed the ICE:
internal compiler error: in gfc_add_modify_loc, at fortran/trans.c:161

Build, regtested and committed (Rev. 181724 ) on x86-64-linux.

Tobias

Patch

Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(revision 181723)
+++ gcc/fortran/ChangeLog	(working copy)
@@ -1,3 +1,8 @@ 
+2011-11-25  Tobias Burnus  <burnus@net-b.de>
+
+	PR fortran/51302
+	* trans-stmt.c (gfc_trans_simple_do): Add a fold_convert.
+
 2011-11-24  Tobias Burnus  <burnus@net-b.de>
 
 	PR fortran/51218
Index: gcc/fortran/trans-stmt.c
===================================================================
--- gcc/fortran/trans-stmt.c	(revision 181723)
+++ gcc/fortran/trans-stmt.c	(working copy)
@@ -1259,7 +1259,8 @@  gfc_trans_simple_do (gfc_code * code, stmtblock_t
   loc = code->ext.iterator->start->where.lb->location;
 
   /* Initialize the DO variable: dovar = from.  */
-  gfc_add_modify_loc (loc, pblock, dovar, from);
+  gfc_add_modify_loc (loc, pblock, dovar,
+		      fold_convert (TREE_TYPE(dovar), from));
   
   /* Save value for do-tinkering checking. */
   if (gfc_option.rtcheck & GFC_RTCHECK_DO)
Index: gcc/testsuite/gfortran.dg/volatile13.f90
===================================================================
--- gcc/testsuite/gfortran.dg/volatile13.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/volatile13.f90	(working copy)
@@ -0,0 +1,11 @@ 
+! { dg-do compile }
+!
+! PR fortran/51302
+!
+! Volatile DO variable - was ICEing before
+!
+integer, volatile :: i
+integer :: n = 1
+do i = 1, n
+end do
+end
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(revision 181723)
+++ gcc/testsuite/ChangeLog	(working copy)
@@ -1,3 +1,8 @@ 
+2011-11-25  Tobias Burnus  <burnus@net-b.de>
+
+	PR fortran/51302
+	* gfortran.dg/volatile13.f90: New.
+
 2011-11-24  Andrew MacLeod  <amacleod@redhat.com>
 
 	PR c/51256