* [Patch, Fortran] PR 41755 - Fix segfault for invalid EQUIVALENCE
@ 2009-10-19 16:43 Tobias Burnus
2009-10-19 16:52 ` Daniel Kraft
2009-10-19 17:05 ` Steve Kargl
0 siblings, 2 replies; 4+ messages in thread
From: Tobias Burnus @ 2009-10-19 16:43 UTC (permalink / raw)
To: gcc patches, gfortran
[-- 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)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch, Fortran] PR 41755 - Fix segfault for invalid EQUIVALENCE
2009-10-19 16:43 [Patch, Fortran] PR 41755 - Fix segfault for invalid EQUIVALENCE Tobias Burnus
@ 2009-10-19 16:52 ` Daniel Kraft
2009-10-19 17:05 ` Steve Kargl
1 sibling, 0 replies; 4+ messages in thread
From: Daniel Kraft @ 2009-10-19 16:52 UTC (permalink / raw)
To: Tobias Burnus; +Cc: gcc patches, gfortran
Tobias Burnus wrote:
> 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.
Ok for all of them, I think 4.4 might be a good idea but don't really
care about that and 4.3, so as you please :)
Thanks for fixing this!
Daniel
--
Done: Arc-Bar-Cav-Ran-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch, Fortran] PR 41755 - Fix segfault for invalid EQUIVALENCE
2009-10-19 16:43 [Patch, Fortran] PR 41755 - Fix segfault for invalid EQUIVALENCE Tobias Burnus
2009-10-19 16:52 ` Daniel Kraft
@ 2009-10-19 17:05 ` Steve Kargl
2009-10-19 18:32 ` Tobias Burnus
1 sibling, 1 reply; 4+ messages in thread
From: Steve Kargl @ 2009-10-19 17:05 UTC (permalink / raw)
To: Tobias Burnus; +Cc: gcc patches, gfortran
On Mon, Oct 19, 2009 at 06:37:59PM +0200, Tobias Burnus wrote:
> 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.
>
I have a slightly different patch, which should probably
be combined with your patch.
Index: match.c
===================================================================
--- match.c (revision 152863)
+++ match.c (working copy)
@@ -3750,7 +3750,10 @@ gfc_match_equivalence (void)
if (gfc_match_eos () == MATCH_YES)
break;
if (gfc_match_char (',') != MATCH_YES)
- goto syntax;
+ {
+ gfc_error ("Expecting a comma in EQUIVALENCE at %C");
+ goto cleanup;
+ }
}
return MATCH_YES;
BTW, it looks like your patch contains some unrelated changes.
--
Steve
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch, Fortran] PR 41755 - Fix segfault for invalid EQUIVALENCE
2009-10-19 17:05 ` Steve Kargl
@ 2009-10-19 18:32 ` Tobias Burnus
0 siblings, 0 replies; 4+ messages in thread
From: Tobias Burnus @ 2009-10-19 18:32 UTC (permalink / raw)
To: Steve Kargl; +Cc: gcc patches, gfortran
[-- Attachment #1: Type: text/plain, Size: 581 bytes --]
Am 19.10.2009 18:52, schrieb Steve Kargl:
> On Mon, Oct 19, 2009 at 06:37:59PM +0200, Tobias Burnus wrote:
>
>> 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
> I have a slightly different patch, which should probabl
> be combined with your patch.
>
I have now build, regtested and committed the combined patch (Rev.
41755). I am currently building 4.4 and will - after regtesting - apply
there the patch as well (without the gfortran.dg/class_allocate_1.f03).
Tobias
[-- Attachment #2: equiv.diff --]
[-- Type: text/x-patch, Size: 2249 bytes --]
2009-10-19 Tobias Burnus <burnus@net-b.de>
Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/41755
* symbol.c (gfc_undo_symbols): Add NULL check.
* match.c (gfc_match_equivalence): Add check for
missing comma.
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 152981)
+++ gcc/fortran/symbol.c (Arbeitskopie)
@@ -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/fortran/match.c
===================================================================
--- gcc/fortran/match.c (Revision 152981)
+++ gcc/fortran/match.c (Arbeitskopie)
@@ -3750,7 +3750,10 @@ gfc_match_equivalence (void)
if (gfc_match_eos () == MATCH_YES)
break;
if (gfc_match_char (',') != MATCH_YES)
- goto syntax;
+ {
+ gfc_error ("Expecting a comma in EQUIVALENCE at %C");
+ goto cleanup;
+ }
}
return MATCH_YES;
Index: gcc/testsuite/gfortran.dg/class_allocate_1.f03
===================================================================
--- gcc/testsuite/gfortran.dg/class_allocate_1.f03 (Revision 152981)
+++ gcc/testsuite/gfortran.dg/class_allocate_1.f03 (Arbeitskopie)
@@ -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)
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 "Expecting a comma in EQUIVALENCE" }
+ end
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-10-19 18:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-19 16:43 [Patch, Fortran] PR 41755 - Fix segfault for invalid EQUIVALENCE Tobias Burnus
2009-10-19 16:52 ` Daniel Kraft
2009-10-19 17:05 ` Steve Kargl
2009-10-19 18:32 ` Tobias Burnus
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).