public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] fortran/67616 -- Fix ICE within a BLOCK construct
@ 2015-09-26  5:41 Steve Kargl
  2015-09-26 19:52 ` Mikael Morin
  0 siblings, 1 reply; 3+ messages in thread
From: Steve Kargl @ 2015-09-26  5:41 UTC (permalink / raw)
  To: fortran, gcc-patches

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

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  <kargl@gcc.gnu.org>

	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  <kargl@gcc.gnu.org>

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

[-- Attachment #2: pr67616.diff --]
[-- Type: text/x-diff, Size: 1018 bytes --]

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

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

* Re: [PATCH] fortran/67616 -- Fix ICE within a BLOCK construct
  2015-09-26  5:41 [PATCH] fortran/67616 -- Fix ICE within a BLOCK construct Steve Kargl
@ 2015-09-26 19:52 ` Mikael Morin
  2015-09-26 21:58   ` Steve Kargl
  0 siblings, 1 reply; 3+ messages in thread
From: Mikael Morin @ 2015-09-26 19:52 UTC (permalink / raw)
  To: Steve Kargl, fortran, gcc-patches

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

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

* Re: [PATCH] fortran/67616 -- Fix ICE within a BLOCK construct
  2015-09-26 19:52 ` Mikael Morin
@ 2015-09-26 21:58   ` Steve Kargl
  0 siblings, 0 replies; 3+ messages in thread
From: Steve Kargl @ 2015-09-26 21:58 UTC (permalink / raw)
  To: Mikael Morin; +Cc: fortran, gcc-patches

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

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

end of thread, other threads:[~2015-09-26 18:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-26  5:41 [PATCH] fortran/67616 -- Fix ICE within a BLOCK construct Steve Kargl
2015-09-26 19:52 ` Mikael Morin
2015-09-26 21:58   ` Steve Kargl

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).