public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <burnus@net-b.de>
To: gcc patches <gcc-patches@gcc.gnu.org>, gfortran <fortran@gcc.gnu.org>
Subject: [Patch, Fortran] PR 41755 - Fix segfault for invalid EQUIVALENCE
Date: Mon, 19 Oct 2009 16:43:00 -0000	[thread overview]
Message-ID: <4ADC95E7.3060800@net-b.de> (raw)

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

I think the patch is obvious. As it works with 4.2, it is a regression.

The FIXME change is unrelated and small - and obviously only for the trunk.

Build and regtested on x86-64-linux.
OK for the trunk and 4.4? - I can also commit it for 4.3, if deemed useful.

Tobias

[-- Attachment #2: equiv.diff --]
[-- Type: text/x-patch, Size: 1680 bytes --]

2009-10-19  Tobias Burnus  <burnus@net-b.de>

	PR fortran/41755
	* symbol.c (gfc_undo_symbols): Add NULL check.
2009-10-19  Tobias Burnus  <burnus@net-b.de>

	PR fortran/41755
	* gfortran.dg/equiv_8.f90: New test.
	* gfortran.dg/class_allocate_1.f03: Remove obsolete FIXME.

Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c	(revision 152976)
+++ gcc/fortran/symbol.c	(working copy)
@@ -2741,7 +2741,7 @@ gfc_undo_symbols (void)
       if (p->gfc_new)
 	{
 	  /* Symbol was new.  */
-	  if (p->attr.in_common && p->common_block->head)
+	  if (p->attr.in_common && p->common_block && p->common_block->head)
 	    {
 	      /* If the symbol was added to any common block, it
 		 needs to be removed to stop the resolver looking
Index: gcc/testsuite/gfortran.dg/equiv_8.f90
===================================================================
--- gcc/testsuite/gfortran.dg/equiv_8.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/equiv_8.f90	(revision 0)
@@ -0,0 +1,7 @@
+! { dg-do compile }
+!
+! PR fortran/41755
+!
+      common /uno/ aa
+      equivalence (aa,aaaaa)   (bb,cc) ! { dg-error "Syntax error in EQUIVALENCE" }
+      end
Index: gcc/testsuite/gfortran.dg/class_allocate_1.f03
===================================================================
--- gcc/testsuite/gfortran.dg/class_allocate_1.f03	(revision 152976)
+++ gcc/testsuite/gfortran.dg/class_allocate_1.f03	(working copy)
@@ -68,8 +68,7 @@
 
  i = 0
  allocate(t2 :: cp2)
-! FIXME: Not yet supported: source=<class>
-! allocate(cp, source = cp2)
+ allocate(cp, source = cp2)
  allocate(t2 :: cp3)
  allocate(cp, source=cp3)
  select type (cp)

             reply	other threads:[~2009-10-19 16:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-19 16:43 Tobias Burnus [this message]
2009-10-19 16:52 ` Daniel Kraft
2009-10-19 17:05 ` Steve Kargl
2009-10-19 18:32   ` Tobias Burnus

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=4ADC95E7.3060800@net-b.de \
    --to=burnus@net-b.de \
    --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).