Re: [PATCH] fortran/67616 -- Fix ICE within a BLOCK construct

2015-09-26 Thread Mikael Morin

Le 25/09/2015 23:41, Steve Kargl a écrit :

The attached patch has been built and regression
tested on x86_64-*-freebsd.  No regression occurred.

The patch removes a conditional within an assert()
that triggers when a BLOCK construct is encountered.

What happens here, I think, is symtree is a new block-local symbol 
instead of the host-associated one.
symtree is basically unused here, yet playing with the wrong one is not 
right.
Can you try using gfc_get_ha_sym_tree a few lines above instead of 
gfc_get_sym_tree?

A patch like that is preapproved.

Mikael


Re: [PATCH] fortran/67616 -- Fix ICE within a BLOCK construct

2015-09-26 Thread Steve Kargl
On Sat, Sep 26, 2015 at 03:34:22PM +0200, Mikael Morin wrote:
> Le 25/09/2015 23:41, Steve Kargl a ??crit :
> > The attached patch has been built and regression
> > tested on x86_64-*-freebsd.  No regression occurred.
> >
> > The patch removes a conditional within an assert()
> > that triggers when a BLOCK construct is encountered.
> >
> What happens here, I think, is symtree is a new block-local symbol 
> instead of the host-associated one.
> symtree is basically unused here, yet playing with the wrong one is not 
> right.
> Can you try using gfc_get_ha_sym_tree a few lines above instead of 
> gfc_get_sym_tree?
> A patch like that is preapproved.
> 

Mikael,

Thanks.  Your suggested change prevents the ICE.  I'll
commit shortly.

-- 
Steve


[PATCH] fortran/67616 -- Fix ICE within a BLOCK construct

2015-09-25 Thread Steve Kargl
The attached patch has been built and regression
tested on x86_64-*-freebsd.  No regression occurred.

The patch removes a conditional within an assert() 
that triggers when a BLOCK construct is encountered.

OK to commit?

2015-09-25  Steven G. Kargl  

PR fortran/67616
* primary.c (gfc_match_structure_constructor): Remove a condition
in an assert() that is not valid within a BLOCK-END BLOCK construct.

2015-09-25  Steven G. Kargl  

PR fortran/67616
* gfortran.dg/pr67616.f90: New test.
-- 
Steve
Index: fortran/primary.c
===
--- fortran/primary.c	(revision 228061)
+++ fortran/primary.c	(working copy)
@@ -2703,8 +2703,7 @@ gfc_match_structure_constructor (gfc_sym
   e->symtree = symtree;
   e->expr_type = EXPR_FUNCTION;
 
-  gcc_assert (sym->attr.flavor == FL_DERIVED
-	  && symtree->n.sym->attr.flavor == FL_PROCEDURE);
+  gcc_assert (sym->attr.flavor == FL_DERIVED);
   e->value.function.esym = sym;
   e->symtree->n.sym->attr.generic = 1;
 
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