[patch,gfortran] Fix PR17917 - module equivalences (redux)
Paul Thomas
paulthomas2@wanadoo.fr
Mon Aug 8 19:10:00 GMT 2005
:ADDPATCH <fortran>:
This version of the fix for module equivalences builds upon the patch
posted in http://gcc.gnu.org/ml/fortran/2005-06/msg00307.html
This time it works correctly. The multiple local equivalences have gone
and are replaced by single external equivalences.
The patch consists of four elements:
(i) The new functions in module.c have been ported from g95. write_equiv
has been modified to attach a name to each module equivalence. I have
chosen <module_name>_equiv<number>. Is there a better way of doing this
to ensure uniqueness?
(ii) trans-decl.c has been modified to prevent equivalenced symbols that
have a backend_decl from being caught by the internal error in
gfc_create_module_variable.
(iii) The module equivalences have a name, which triggers the creation
of a gfc_common_header. This, when passed to create common, ensures that
the equivalences are treated in the same way as common blocks; ie. they
become external and public.
(iv) gfc_equiv has the module field added in gfortran.h
The test case tests the equivalences are transmitted between procedures,
that renamed equivalence symbols are dealt with and that common block
equivalences are not broken by the patch. I have tested that the loader
does the right thing when the module and the subroutine foo are compiled
separately from the main program; ie. that the equivalences really are
external. Is there some way to do this in the testsuite?
Bubblestrapped and regtested on FC3/Athlon 1700.
OK for mainline and 4.0?
Paul T
2005-08-08 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-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/17917
* gfortran.dg/module_equivalence_1.f90: New.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: module.c.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050808/1d12a4d9/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: trans-decl.c.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050808/1d12a4d9/attachment-0001.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: trans-common.c.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050808/1d12a4d9/attachment-0002.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gfortran.h.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050808/1d12a4d9/attachment-0003.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: module_equivalence_1.f90
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050808/1d12a4d9/attachment.f90>
More information about the Gcc-patches
mailing list