[Patch, gfortran] PR22304, 17917, 16511, 18870 and 23270 - modules, equivalences and commons

Paul Thomas paulthomas2@wanadoo.fr
Mon Aug 22 06:28:00 GMT 2005


:ADDPATCH <fortran>:

This patch supercedes:

http://gcc.gnu.org/ml/gcc-patches/2005-08/msg01070.html
http://gcc.gnu.org/ml/gcc-patches/2005-08/msg01071.html
http://gcc.gnu.org/ml/gcc-patches/2005-08/msg01072.html
http://gcc.gnu.org/ml/gcc-patches/2005-08/msg01073.html
http://gcc.gnu.org/ml/gcc-patches/2005-08/msg01144.html

The comments on these versions have been responded to and the 
appropriate improvements made.  I think that it would be helpful to 
retain these patches in the queue, if for no other reason than that they 
serve as references.  I would like, if possible, to clear them all at once.

In addition, the attached patch deals with two further problems:

PR18870 - prevents indirect equivalencing of different common blocks.
PR23270 - adds module blank common.

I have run out of time before going away for nearly a couple of weeks 
and so was not able to separate out the different components of the 
work.  I had a notion that I might annotate the accumulated patch, but 
the changelog entries serve quite well enough for this.

I am aware that this has become a bit of a monster but it should be 
quite comprehensible with the changelog remarks and the comments.

The improvement in functionality with modules/commons/equivalences 
should be apparent from the testcases.

Bootstrapped and regtested on Athlon1700/FC3.

OK for mainline and 4.0?

Paul T

The patches and testcases are in inverse chronological order.

=================fortran.diff===============

2005-08-22  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/23270
    * gfortran.h: Move definition of BLANK_COMMON_NAME from trans-
    common.c so that it is accessible to module.c.
    * module.c (write_blank_common): New.
    * module.c (write_module): Call write_blank_common.

2005-08-22  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/18870
    * gfortran.h: Add common_head field to gfc_symbol structure.
    * match.c (gfc_match_common, gfc_match_equivalence): In loops
    that flag common block equivalences, emit an error if the
    common blocks are different, using sym->common_head as the
    common block identifier.

2005-08-22  Paul Thomas  <pault@gcc.gnu.org>

    * module.c (write_common): Demangle common block names
    and restore them to their fortran form.
    * match.c (gfc_get_common): Mangle use associated common
    blocks with an incrementing serial number for each block
    and in each namespace. The common block symtree name is
    left unmangled so that the external reference is OK.

2005-08-22  Paul Thomas  <pault@gcc.gnu.org>

    * trans-decl.c (gfc_generate_function_code): Move the call to
    gfc_generate_contained_functions to after the call to
    gfc_trans_common so the use-associated, use-associated common
    blocks produce the correct references.

2005-08-22  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/16511
    * gfortran.h: new attr field, in_equivalence.
    * match.c (gfc_match_common, gfc_match_equivalence): Ensure that
    symbols that are equivalence associated with a common block are
    marked as being in_common.

2005-08-22  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/17917
    * module.c (load_equiv): New function ported from g95.
    (read_module): Call load_equiv.
    (write_equiv): New function ported from g95. Correct
    string referencing for gfc functions. Give module
    equivalences a unique name.
    (write_module): Call write_equiv.
    * trans_decl.c (gfc_create_module_variable): Return for
    equivalenced symbols with existing backend declaration.
    * trans-common.c (finish_equivalences): Provide the call
    to create_common with a gfc_common_header so that
    module equivalences are made external, rather than local.
    * gfortran.h (gfc_equiv): Add field for the equivalence
    name.

2005-08-22  Paul Thomas  <pault@gcc.gnu.org>
        Mike Albert  <albertm@uphs.upenn.edu>

    PR fortran/22304
    * trans-common.c (find_equivalences): Ensure that all members
    in common block equivalences are marked as used. This prevents
    the subsequent call to this function from making local unions.

=================test cases===============

2005-08-22  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/23270
    * gfortran.dg/module_blank_common.f90: New.

2005-08-22  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/18870
    * gfortran.dg/common_equivalence_2.f: New.
    * gfortran.dg/common_equivalence_3.f: New.

2005-08-22  Paul Thomas  <pault@gcc.gnu.org>

    * gfortran.dg/host_common.f90: New.
    * gfortran.dg/modules_commons_1.f90: New.

2005-08-22  Paul Thomas  <pault@gcc.gnu.org>

    * gfortran.dg/nested_modules_1.f90: New.

2005-08-22  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/16511
    * gfortran.dg/g77/19990905-0.f: Remove XFAIL and add comment to
    connect the test with the PR.

2005-08-22  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/17917
    * gfortran.dg/module_equivalence_1.f90: New.

2005-08-22  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/22304
    * gfortran.dg/common_equivalence_1.f: New.













-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fortran.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050822/e591771d/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: common_equivalence_1.f
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050822/e591771d/attachment-0001.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: common_equivalence_2.f
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050822/e591771d/attachment-0002.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: common_equivalence_3.f
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050822/e591771d/attachment-0003.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: host_common.f90
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050822/e591771d/attachment.f90>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: module_blank_common.f90
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050822/e591771d/attachment-0001.f90>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: module_commons_1.f90
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050822/e591771d/attachment-0002.f90>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: module_equivalence_1.f90
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050822/e591771d/attachment-0003.f90>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: nested_modules_1.f90
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050822/e591771d/attachment-0004.f90>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 1990905-0.f.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050822/e591771d/attachment-0004.ksh>


More information about the Gcc-patches mailing list