[PATCH, fortran] Constraints for equivalence members and private types

Paul THOMAS paulthomas2@wanadoo.fr
Fri Sep 23 11:58:00 GMT 2005


:ADDPATCH fortran:

This proposed patch applies a number of constraints, required by the f95 standard, that were missing from gfortran. These are mainly to do with equivalence objects but two are connected with private types.

Since each constraint has its own block of code and the comments indicate what each is for, it seemed efficient to submit them all together. Also, the code is sufficiently clear as not to warrant a description here. If this is inconvenient for the reviewer, I can break the patchup and/or provide descriptions for each.

As a general remark, I had started to implement the constraints in symbol.c(check_conflict) but found that the majority of the equivalence constraints were to be found in resolve.c. I therefore elected to put the rest there too.

I have only made the constraint on equivalence mixing of numeric/character/structure subject to the -std=f95 option for g77 compatibility. I do not think that this would make any sense for any of the others but I am open to suggestions there.

Regtested on Cygwin/i686 and FC3/Athlon 1700.

OK for mainline and 4.03, when open?

Paul T

Note: tabs have gone to cutting and pasting in Windows - see the attachment
===================================================================
2005-09-23 Paul Thomas 
PR fortran/16404
PR fortran/20835
PR fortran/20890
PR fortran/20899
PR fortran/20900
PR fortran/20901
PR fortran/20902
* match.c (gfc_match_equivalence): Make a structure component
an explicit,rather than a syntax, error in an equivalence
group. Error for USE associated EQUIVALENCE members.
* resolve.c (resolve_symbol): Add constraints: No public
structures with private-type components and no public
procedures with private-type dummy arguments.
(resolve_equivalence_derived): Add constraint that prevents
a structure equivalence member from having a default
initializer.
(resolve_equivalence): Add constraints to equivalence groups
or their members: No more than one initialized member, that
different types are not equivalenced for std=f95, no TARGET
members and no common block members in a pure procedure

2005-09-23 Paul Thomas 
PR fortran/16404
PR fortran/20835
PR fortran/20890
PR fortran/20899
PR fortran/20900
PR fortran/20901
PR fortran/20902
gfortran.dg/equiv_constraint_1.f90: New test.
gfortran.dg/equiv_constraint_2.f90: New test.
gfortran.dg/equiv_constraint_3.f90: New test.
gfortran.dg/equiv_constraint_4.f90: New test.
gfortran.dg/equiv_constraint_5.f90: New test.
gfortran.dg/equiv_constraint_6.f90: New test.
gfortran.dg/equiv_constraint_7.f90: New test.
gfortran.dg/equiv_constraint_8.f90: New test.
gfortran.dg/private_type_1.f90: New test.
gfortran.dg/private_type_2.f90: New test.
gfortran.dg/g77/980628-3.f, 980628-3.f: Assert std=gnu to
permit mixing of types in equivalence statements.

> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: constraints_patch.msg
Type: application/octet-stream
Size: 18241 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050923/516a73bf/attachment.obj>


More information about the Gcc-patches mailing list