This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[Patch, Fortran] PR 41755 - Fix segfault for invalid EQUIVALENCE
- From: Tobias Burnus <burnus at net-b dot de>
- To: gcc patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Mon, 19 Oct 2009 18:37:59 +0200
- Subject: [Patch, Fortran] PR 41755 - Fix segfault for invalid EQUIVALENCE
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
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)