Message ID | cd6e76e2-bf3a-35e3-3bc7-b6c4b60bd04c@student.ethz.ch |
---|---|
State | New |
Headers | show |
Hello again, I forgot to add the test case this patch fixes and to give Paul the credit. Attached the new test case. Nicolas New & improved changelog: 2017-04-10 Nicolas Koenig <koenigni@student.ethz.ch> Paul Thomas <pault@gcc.gnu.org> PR fortran/69498 * module.c (gfc_match_submodule): Add error if function is called in the wrong state. 2017-04-10 Nicolas Koenig <koenigni@student.ethz.ch> PR fortran/69498 * gfortran.dg/submodule_unexp.f90: Modified test to account for new error. * gfortran.dg/submodule_twice.f90: New Test On 04/10/2017 06:53 PM, Nicolas Koenig wrote: > Hello everyone, > > Dominique send me this patch written by Paul some time ago. For some > reason it was never committed, so here we go :) > > Ok for trunk? > > Nicolas > > Regression tested for x86_64-pc-linux-gnu. > > Changelog: > 2017-03-18 Nicolas Koenig <koenigni@student.ethz.ch> > PR fortran/69498 > * module.c (gfc_match_submodule): Add error > if function is called in the wrong state. > > 2017-03-18 Nicolas Koenig <koenigni@student.ethz.ch> > PR fortran/69498 > * gfortran.dg/submodule_unexp.f90: Modified test > to account for new error. > >
Dear Nicolas, The reasons are (i) moving country and (ii) the daytime job :-) I think that in the circumstances somebody else should OK the patch, although I think that it is perfect in every way possible. Actually, perhaps it is sufficiently obvious that I would and should have committed it - OK for trunk. Thanks Paul On 10 April 2017 at 17:53, Nicolas Koenig <koenigni@student.ethz.ch> wrote: > Hello everyone, > > Dominique send me this patch written by Paul some time ago. For some reason > it was never committed, so here we go :) > > Ok for trunk? > > Nicolas > > Regression tested for x86_64-pc-linux-gnu. > > Changelog: > 2017-03-18 Nicolas Koenig <koenigni@student.ethz.ch> > PR fortran/69498 > * module.c (gfc_match_submodule): Add error > if function is called in the wrong state. > > 2017-03-18 Nicolas Koenig <koenigni@student.ethz.ch> > PR fortran/69498 > * gfortran.dg/submodule_unexp.f90: Modified test > to account for new error. > >
Hello Paul, I would argue that this is but an elaborate plan to teach a newbie the ways of the bugzilla and enable him to properly close his first bug ;) Anyway, committed as r246826. Thanks for the review. Nicolas On 04/10/2017 08:07 PM, Paul Richard Thomas wrote: > Dear Nicolas, > > The reasons are (i) moving country and (ii) the daytime job :-) > > I think that in the circumstances somebody else should OK the patch, > although I think that it is perfect in every way possible. > > Actually, perhaps it is sufficiently obvious that I would and should > have committed it - OK for trunk. > > Thanks > > Paul > > > On 10 April 2017 at 17:53, Nicolas Koenig <koenigni@student.ethz.ch> wrote: >> Hello everyone, >> >> Dominique send me this patch written by Paul some time ago. For some reason >> it was never committed, so here we go :) >> >> Ok for trunk? >> >> Nicolas >> >> Regression tested for x86_64-pc-linux-gnu. >> >> Changelog: >> 2017-03-18 Nicolas Koenig <koenigni@student.ethz.ch> >> PR fortran/69498 >> * module.c (gfc_match_submodule): Add error >> if function is called in the wrong state. >> >> 2017-03-18 Nicolas Koenig <koenigni@student.ethz.ch> >> PR fortran/69498 >> * gfortran.dg/submodule_unexp.f90: Modified test >> to account for new error. >> >> > >
Index: gcc/fortran/module.c =================================================================== --- gcc/fortran/module.c (revision 246743) +++ gcc/fortran/module.c (working copy) @@ -741,6 +741,13 @@ gfc_match_submodule (void) if (!gfc_notify_std (GFC_STD_F2008, "SUBMODULE declaration at %C")) return MATCH_ERROR; + if (gfc_current_state () != COMP_NONE) + { + gfc_error ("SUBMODULE declaration at %C cannot appear within " + "another scoping unit"); + return MATCH_ERROR; + } + gfc_new_block = NULL; gcc_assert (module_list == NULL); Index: gcc/testsuite/gfortran.dg/submodule_unexp.f90 =================================================================== --- gcc/testsuite/gfortran.dg/submodule_unexp.f90 (revision 246743) +++ gcc/testsuite/gfortran.dg/submodule_unexp.f90 (working copy) @@ -3,6 +3,6 @@ ! This used to ICE program p type t - submodule (m) sm ! { dg-error "Unexpected SUBMODULE statement at" } + submodule (m) sm ! { dg-error "SUBMODULE declaration at" } end type end