This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Dear All, These are two rather trivial modifications to permit, 'module' to appear at any position in the list of prefixes in the procedure declaration and to allow module procedures to appear within a module contains section. I was rather astonished at this latter since it does seem to be rather contrary to having an module interface declaration for the same procedure. However, from the Fortran 2008 standard: C1247 (R1225) MODULE shall appear only in the function-stmt or subroutine-stmt of a module subprogram or of a nonabstract interface body that is declared in the scoping unit of a module or submodule. Whilst I was about it, I prevented an ICE from occurring following the error generated by decl.c(copy_prefix), when prefixes in the interface are repeated in the procedure declaration. I have not included a test for this, since I am not convinced that repeating the prefixes is strictly speaking an error. In fact, it would make a lot of sense to repeat the interface declaration completely in the submodule declaration. I will investigate further before committing. The fix is even more trivial than preventing the ICE. Since the patch is entirely permissive, it will not prevent correct code from compiling. In this sense, it is safe for stage 4. Bootstrapped and regtested on FC21/x86_64. OK for trunk? Best regards Paul 2016-03-06 Paul Thomas <pault@gcc.gnu.org> PR fortran/70031 * decl.c (gfc_match_prefix): Treat the 'module' prefix in the same way as the others, rather than fixing it to come last. (gfc_match_function_decl, gfc_match_subroutine): After errors in 'copy_prefix', emit them immediately in the case of module procedures to prevent a later ICE. PR fortran/69524 * decl.c (gfc_match_submod_proc): Permit 'module procedure' declarations within the contains section of modules as well as submodules. * resolve.c (resolve_fl_procedure): Likewise. *trans-decl.c (build_function_decl): Change the gcc_assert to allow all forms of module procedure declarations within module contains sections. 2016-03-06 Paul Thomas <pault@gcc.gnu.org> PR fortran/70031 * gfortran.dg/submodule_14.f08: New test PR fortran/69524 * gfortran.dg/submodule_15.f08: New test
Attachment:
submit.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |