public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, fortran] PR32867 - ICE on nested initialization expressions
@ 2007-07-24  9:38 Daniel Franke
  2007-07-24 17:01 ` Daniel Franke
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Franke @ 2007-07-24  9:38 UTC (permalink / raw)
  To: fortran; +Cc: gcc-patches, hjl

[-- Attachment #1: Type: text/plain, Size: 642 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pr32867.patch --]
[-- Type: text/x-diff; name="pr32867.patch", Size: 1355 bytes --]

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" } }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch, fortran] PR32867 - ICE on nested initialization expressions
  2007-07-24  9:38 [patch, fortran] PR32867 - ICE on nested initialization expressions Daniel Franke
@ 2007-07-24 17:01 ` Daniel Franke
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Franke @ 2007-07-24 17:01 UTC (permalink / raw)
  To: fortran; +Cc: gcc-patches, hjl

On Tuesday 24 July 2007 10:41:05 Daniel Franke wrote:
> 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.

Ok'ed by Janne and Tobias on IRC. Committed as r126882.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-24 16:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-24  9:38 [patch, fortran] PR32867 - ICE on nested initialization expressions Daniel Franke
2007-07-24 17:01 ` Daniel Franke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).