diff mbox

fortran/67616 -- Fix ICE in BLOCK with a DATA statement

Message ID 20151001000315.GA73614@troutmask.apl.washington.edu
State New
Headers show

Commit Message

Steve Kargl Oct. 1, 2015, 12:03 a.m. UTC
The attached patch was built and tested on x86_64-*-freebsd.
OK to commit?

The patch prevents an ICE in a BLOCK construct that uses
a DATA statement and default initialization.  The problem
was that the derived typed was declared in the host and
was not in the BLOCK's symtree.  The fix looks for the 
derived type through host associate.

Just remembered Mikael pre-approved patch.

2015-09-30  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/67616
	* primary.c (gfc_match_structure_constructor): Use a possibly
	host-associated symtree to prevent ICE.

2015-09-30  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/67616
	* gfortran.dg/pr67616.f90: New test.

Comments

Mikael Morin Oct. 1, 2015, 12:27 p.m. UTC | #1
Le 01/10/2015 02:03, Steve Kargl a écrit :
> The attached patch was built and tested on x86_64-*-freebsd.
> OK to commit?
>
> The patch prevents an ICE in a BLOCK construct that uses
> a DATA statement and default initialization.  The problem
> was that the derived typed was declared in the host and
> was not in the BLOCK's symtree.  The fix looks for the
> derived type through host associate.
>
> Just remembered Mikael pre-approved patch.
>
Yes, OK again. :-)
diff mbox

Patch

Index: fortran/primary.c
===================================================================
--- fortran/primary.c	(revision 228306)
+++ fortran/primary.c	(working copy)
@@ -2697,7 +2697,7 @@  gfc_match_structure_constructor (gfc_sym
   gfc_expr *e;
   gfc_symtree *symtree;
 
-  gfc_get_sym_tree (sym->name, NULL, &symtree, false);   /* Can't fail */
+  gfc_get_ha_sym_tree (sym->name, &symtree);
 
   e = gfc_get_expr ();
   e->symtree = symtree;
Index: testsuite/gfortran.dg/pr67616.f90
===================================================================
--- testsuite/gfortran.dg/pr67616.f90	(revision 0)
+++ testsuite/gfortran.dg/pr67616.f90	(working copy)
@@ -0,0 +1,13 @@ 
+! { dg-do compile }
+! PR fortran/67616
+! Original code contributed by Gerhard Steinmetz 
+program p
+   type t
+   end type
+   type(t) :: y
+   data y /t()/
+   block
+      type(t) :: x
+      data x /t()/      ! Prior to patch, this would ICE.
+   end block
+end