This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Bug fortran/52846] [F2008] Support submodules - part 2/3
- From: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- To: "Bader, Reinhold" <Reinhold dot Bader at lrz dot de>
- Cc: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 15 Jul 2015 13:19:33 +0200
- Subject: Re: [Bug fortran/52846] [F2008] Support submodules - part 2/3
- Authentication-results: sourceware.org; auth=none
- References: <CAGkQGi+GExJRCeULTGWsjeSOJhF=6QGN_f-EOu2vxJPd_NqDGw at mail dot gmail dot com> <1372b73b23db4728801d81edd7cd6066 at BADWLRZ-SW13MB6 dot ads dot mwn dot de>
Dear Reinhold,
I didn't change the internal symbol names because @ is not allowed in
linker symbol names. I'll use '.' internally.
Thanks for letting me know. Obviously, I have a little bit more work
to do before the patch can be committed :-(
Paul
On 15 July 2015 at 12:58, Bader, Reinhold <Reinhold.Bader@lrz.de> wrote:
> Hello Paul,
>
> the attached example fails to compile with the error message
>
> Error: Global name Âmod_s at (1) is already being used as a MODULE at (2)
> subm_10_pos.f90:29:6:
>
> use mod_s
>
> However, the global identifier of a submodule is the pair (ancestor module name,
> submodule name) according to 11.2.3, para 2 of the Fortran 2008 standard. So
> I think the error message is spurious.
>
> Cheers
> Reinhold
>
>> -----UrsprÃngliche Nachricht-----
>> Von: Paul Richard Thomas [mailto:paul.richard.thomas@gmail.com]
>> Gesendet: Dienstag, 14. Juli 2015 13:10
>> An: Bader, Reinhold; fortran@gcc.gnu.org; gcc-patches
>> Betreff: [Bug fortran/52846] [F2008] Support submodules - part 2/3
>>
>> Dear All,
>>
>> Reinhold Bader has pointed out the naming the submodule files after the
>> submodule name and using .mod as the extension can potentially lead to
>> clashes. Therefore, I have written a patch to change gfortran to follow the
>> naming convention of another leading brand:
>>
>> submodule filename = module@ancestor@....@submodule.smod
>>
>> The implementation is straightforward and the ChangeLog and the patch
>> provide an adequate description.
>>
>> Bootstraps and regtests on x86_64 - OK for trunk?
>>
>> Paul
>>
>> 2015-07-14 Paul Thomas <pault@gcc.gnu.org>
>>
>> PR fortran/52846
>> * gfortran.h : Add 'submodule_name' to gfc_use_list structure.
>> * module.c (gfc_match_submodule): Define submodule_name and add
>> static 'submodule_name'.
>> (gfc_match_submodule): Build up submodule filenames, using '@'
>> as a delimiter. Store the output filename in 'submodule_name'.
>> (gfc_dump_module): If current state is COMP_SUBMODULE, write
>> to file 'submodule_name', using SUBMODULE_EXTENSION.
>> (gfc_use_module): Similarly, use the 'submodule_name' field in
>> the gfc_use_list structure and SUBMODULE_EXTENSION to read the
>> implicitly used submodule files.
--
Outside of a dog, a book is a man's best friend. Inside of a dog it's
too dark to read.
Groucho Marx