This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, fortran] PR32867 - ICE on nested initialization expressions


This is a regression that stems from my recent init-expressions patch.
Nested expressions were not simplified properly and thus led to ICEs
in various places. The cure is simple enough, H.J. already confirmed
that it also fixes the problem he observed.


:ADDPATCH fortran:


gcc/fortran:
2007-07-24  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/32867
	* expr.c (check_init_expr): Simplify matched functions.

gcc/testsuite:
2007-07-24  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/32867
	* fortran.dg/initialization_10.f90: New test.


Bootstrapped and regression tested on i686-pc-linux-gnu. Ok for trunk?


Regards
	Daniel
Index: fortran/expr.c
===================================================================
--- fortran/expr.c	(revision 126826)
+++ fortran/expr.c	(working copy)
@@ -2121,7 +2132,7 @@
 	}
 
       if (m == MATCH_YES)
-	t = SUCCESS;
+	t = gfc_simplify_expr (e, 0);
 
       break;
 
Index: testsuite/gfortran.dg/initialization_10.f90
===================================================================
--- testsuite/gfortran.dg/initialization_10.f90	(revision 0)
+++ testsuite/gfortran.dg/initialization_10.f90	(revision 0)
@@ -0,0 +1,32 @@
+! { dg-do compile }
+!
+! PR fortran/32867 - nested initialization expression not simplified
+!
+! Testcase contributed by H. J. Lu <hjl AT lucon DOT org>
+!
+
+MODULE Readdata_mod
+IMPLICIT NONE
+Private
+Public Parser
+  integer, parameter :: nkeywords = 2
+character(80), PARAMETER, dimension(1:nkeywords) :: keywords = &
+(/'PROBLEMSIZE                                  ',             &
+  'NFTRANS_TD                                   '/)
+
+CONTAINS
+SUBROUTINE Parser(nx, ny, keyword)
+integer, intent(inout) :: nx, ny
+character(80), intent(inout) :: keyword
+
+select case (keyword)
+  case (trim(keywords(1))) ! PROBLEMSIZE
+    nx = 1
+  case (trim(keywords(2))) !'NFTRANS_TD'
+    ny = 1
+end select
+
+END SUBROUTINE Parser
+END MODULE Readdata_mod
+
+! { dg-final { cleanup-modules "Readdata_mod" } }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]