The attached patch allows for F2008's optional double colon in a module procedure statement. Built and regression tested on trunk. OK for trunk and 4.6?
Steven G. Kargl <ka...@gcc.gnu.org> PR fortran/49265 * decl.c (gfc_match_modproc): Allow for a double colon in a module procedure statement. 2011-06-02 Steven G. Kargl <ka...@gcc.gnu.org> PR fortran/49265 * gfortran.dg/module_procedure_double_colon.f90: New test. -- Steve
Index: gcc/fortran/ChangeLog =================================================================== --- gcc/fortran/ChangeLog (revision 174566) +++ gcc/fortran/ChangeLog (working copy) @@ -1,3 +1,9 @@ +2011-06-02 Steven G. Kargl <ka...@gcc.gnu.org> + + PR fortran/49265 + * decl.c (gfc_match_modproc): Allow for a double colon in a module + procedure statement. + 2011-05-31 Tobias Burnus <bur...@net-b.de> PR fortran/18918 Index: gcc/fortran/decl.c =================================================================== --- gcc/fortran/decl.c (revision 174566) +++ gcc/fortran/decl.c (working copy) @@ -7016,6 +7016,7 @@ gfc_match_modproc (void) char name[GFC_MAX_SYMBOL_LEN + 1]; gfc_symbol *sym; match m; + locus old_locus; gfc_namespace *module_ns; gfc_interface *old_interface_head, *interface; @@ -7044,10 +7045,22 @@ gfc_match_modproc (void) end up with a syntax error and need to recover. */ old_interface_head = gfc_current_interface_head (); + /* Check if the F2008 optional double colon appears. */ + old_locus = gfc_current_locus; + if (gfc_match (" :: ") == MATCH_YES) + { + if (gfc_notify_std (GFC_STD_F2008, "Fortran 2008: double colon in " + "MODULE PROCEDURE statement at %L", &old_locus) + == FAILURE) + return MATCH_ERROR; + } + else + gfc_current_locus = old_locus; + for (;;) { - locus old_locus = gfc_current_locus; bool last = false; + old_locus = gfc_current_locus; m = gfc_match_name (name); if (m == MATCH_NO) @@ -7059,6 +7072,7 @@ gfc_match_modproc (void) current namespace. */ if (gfc_match_eos () == MATCH_YES) last = true; + if (!last && gfc_match_char (',') != MATCH_YES) goto syntax; Index: gcc/testsuite/ChangeLog =================================================================== --- gcc/testsuite/ChangeLog (revision 174566) +++ gcc/testsuite/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2011-06-02 Steven G. Kargl <ka...@gcc.gnu.org> + + PR fortran/49265 + * gfortran.dg/module_procedure_double_colon.f90: New test. + 2011-06-02 Eric Botcazou <ebotca...@adacore.com> Hans-Peter Nilsson <h...@axis.com> Index: gcc/testsuite/gfortran.dg/module_procedure_double_colon.f90 =================================================================== --- gcc/testsuite/gfortran.dg/module_procedure_double_colon.f90 (revision 0) +++ gcc/testsuite/gfortran.dg/module_procedure_double_colon.f90 (revision 0) @@ -0,0 +1,16 @@ +! { dg-do compile } +! { dg-options "-std=f95" } +! +! PR fortran/49265 +! Contributed by Erik Toussaint +! +module m1 + implicit none + interface foo + module procedure :: bar ! { dg-error "double colon" } + end interface +contains + subroutine bar + end subroutine +end module +! { dg-final { cleanup-modules "m1" } }