public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [PATCH] fortran/67616 -- Fix ICE within a BLOCK construct
Date: Sat, 26 Sep 2015 05:41:00 -0000	[thread overview]
Message-ID: <20150925214129.GA19593@troutmask.apl.washington.edu> (raw)

[-- 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

             reply	other threads:[~2015-09-25 21:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-26  5:41 Steve Kargl [this message]
2015-09-26 19:52 ` Mikael Morin
2015-09-26 21:58   ` Steve Kargl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150925214129.GA19593@troutmask.apl.washington.edu \
    --to=sgk@troutmask.apl.washington.edu \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).