This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/29786] [4.1/4.2/4.3 Regression] rejects equivalence



------- Comment #2 from pault at gcc dot gnu dot org  2006-11-10 08:25 -------
(In reply to comment #1)
14.6.3.3 Association of scalar data objects
...snip...
A storage unit shall not be explicitly initialized more than once in a program.
Explicit initialization overrides default initialization, and default
initialization for an object of derived type overrides default initialization
for a component of the object (4.4.1). Default initialization may be specified
for a storage unit that is storage associated provided the objects or
subobjects supplying the default initialization are of the same type and type
parameters, and supply the same value for the storage unit.

This is intended to be general, I think; ie. to apply to more than scalar data
objects.  In any case, prior usage requires that "storage unit" be understood
in its complete generality.

The problem occurs in resolve.c:6674, where there is no attempt to see if the
storage unit is the same for scalar/array-ref or array-ref/array-ref
equivalences and data statements.  This is OK for F90 initialization, where
arrays are completely initialized, but not for data statements.

If the error is suppressed by excluding (sym->attr.data && sym->as != NULL), we
run into a todo in trans-common.c:

pr29786.f90: In function 'MAIN__':
pr29786.f90:1: fatal error: gfc_todo: Not Implemented: Initialization of
overlap
ping variables compilation terminated.

This looks like one of Sherlock Holme's "three pipers".

Paul

Index: gcc/fortran/resolve.c
===================================================================
*** gcc/fortran/resolve.c       (révision 118551)
--- gcc/fortran/resolve.c       (copie de travail)
*************** resolve_equivalence (gfc_equiv *eq)
*** 6671,6677 ****

        /* An equivalence statement cannot have more than one initialized
         object.  */
!       if (sym->value)
        {
          if (value_name != NULL)
            {
--- 6671,6677 ----

        /* An equivalence statement cannot have more than one initialized
         object.  */
!       if (sym->value && !(sym->attr.data && sym->as != NULL))
        {
          if (value_name != NULL)
            {


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29786


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]