This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[Patch, Fortran, Committed] PR34557 - Fix substring handling of EQUIVALENCE
- From: Tobias Burnus <burnus at net-b dot de>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>, "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>
- Date: Fri, 04 Jan 2008 10:15:42 +0100
- Subject: [Patch, Fortran, Committed] PR34557 - Fix substring handling of EQUIVALENCE
The following patch is obvious and was approved by Thomas in the PR.
gfortran was stumbling over the space before "(1:1)" and gave thus a
syntax error:
EQUIVALENCE (A (2,1) (1:1) ...
The program actually works as fixed-form source code.
Committed as Rev. 131317.
Tobias
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (Revision 131316)
+++ gcc/testsuite/ChangeLog (Arbeitskopie)
@@ -1,3 +1,8 @@
+2008-01-04 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/34557
+ * gfortran.dg/equiv_substr.f90: New.
+
2008-01-03 Tom Tromey <tromey@redhat.com>
PR c/34457:
Index: gcc/testsuite/gfortran.dg/equiv_substr.f90
===================================================================
--- gcc/testsuite/gfortran.dg/equiv_substr.f90 (Revision 0)
+++ gcc/testsuite/gfortran.dg/equiv_substr.f90 (Revision 0)
@@ -0,0 +1,10 @@
+! { dg-do compile }
+!
+! PR fortran/34557
+!
+! Substrings with space before '(' were not properly parsed.
+!
+implicit none
+character :: A(2,2)*2, B(2)*3, C*5
+equivalence (A (2,1) (1:1), B (1) (2:3), C (3:5))
+end
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog (Revision 131316)
+++ gcc/fortran/ChangeLog (Arbeitskopie)
@@ -0,0 +1,5 @@
+2008-01-04 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/34557
+ * primary.c (match_varspec): Gobble whitespace before
+ checking for '('.
Index: gcc/fortran/primary.c
===================================================================
--- gcc/fortran/primary.c (Revision 131316)
+++ gcc/fortran/primary.c (Arbeitskopie)
@@ -1679,6 +1679,7 @@ match_varspec (gfc_expr *primary, int eq
tail = NULL;
+ gfc_gobble_whitespace ();
if ((equiv_flag && gfc_peek_char () == '(') || sym->attr.dimension)
{
/* In EQUIVALENCE, we don't know yet whether we are seeing
@@ -1692,6 +1693,7 @@ match_varspec (gfc_expr *primary, int eq
if (m != MATCH_YES)
return m;
+ gfc_gobble_whitespace ();
if (equiv_flag && gfc_peek_char () == '(')
{
tail = extend_ref (primary, tail);