[PATCH] Automatics in equivalence statements

Mark Eggleston mark.eggleston@codethink.co.uk
Fri Jun 21 13:31:00 GMT 2019


Currently variables with the AUTOMATIC attribute can not appear in an 
EQUIVALENCE statement. However its counterpart, STATIC, can be used in 
an EQUIVALENCE statement.

Where there is a clear conflict in the attributes of variables in an 
EQUIVALENCE statement an error message will be issued as is currently 
the case.

If there is no conflict e.g. a variable with a AUTOMATIC attribute and a 
variable(s) without attributes all variables in the EQUIVALENCE will 
become AUTOMATIC.

Note: most of this patch was written by Jeff Law <law@redhat.com>

Please review.

ChangeLogs:

gcc/fortran

     Jeff Law  <law@redhat.com>
     Mark Eggleston  <mark.eggleston@codethink.com>

     * gfortran.h: Add check_conflict declaration.
     * symbol.c (check_conflict): Remove automatic in equivalence conflict
     check.
     * symbol.c (save_symbol): Add check for in equivalence to stop the
     the save attribute being added.
     * trans-common.c (build_equiv_decl): Add is_auto parameter and
     add !is_auto to condition where TREE_STATIC (decl) is set.
     * trans-common.c (build_equiv_decl): Add local variable is_auto,
     set it true if an atomatic attribute is encountered in the variable
     list.  Call build_equiv_decl with is_auto as an additional parameter.
     flag_dec_format_defaults is enabled.
     * trans-common.c (accumulate_equivalence_attributes) : New subroutine.
     * trans-common.c (find_equivalence) : New local variable dummy_symbol,
     accumulated equivalence attributes from each symbol then check for
     conflicts.

gcc/testsuite

     Mark Eggleston <mark.eggleston@codethink.com>

     * gfortran.dg/auto_in_equiv_1.f90: New test.
     * gfortran.dg/auto_in_equiv_2.f90: New test.
     * gfortran.dg/auto_in_equiv_3.f90: New test.

-- 
https://www.codethink.co.uk/privacy.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Allow-automatics-in-equivalence.patch
Type: text/x-patch
Size: 12009 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20190621/207f9987/attachment.bin>


More information about the Fortran mailing list