[Bug fortran/30875] Equivalence of derived types with (same) default initializer
--- Comment #4 from pault at gcc dot gnu dot org 2007-06-11 22:39 --- Subject: Bug 30875 Author: pault Date: Mon Jun 11 22:39:21 2007 New Revision: 125628 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=125628 Log: 2007-06-12 Paul Thomas [EMAIL PROTECTED] PR fortran/29786 PR fortran/30875 * trans-common.c (get_init_field): New function. (create_common): Call get_init_field for overlapping initializers in equivalence blocks. * resolve.c (resolve_equivalence_derived, resolve_equivalence): Remove constraints on initializers in equivalence blocks. * target-memory.c (expr_to_char, gfc_merge_initializers): New functions. (encode_derived): Add the bit offset to the byte offset to get the total offset to the field. * target-memory.h : Add prototype for gfc_merge_initializers. 2007-06-12 Paul Thomas [EMAIL PROTECTED] PR fortran/29786 * gfortran.dg/equiv_7.f90: New test. * gfortran.dg/equiv_constraint_7.f90: Change error message. PR fortran/30875 * gfortran.dg/equiv_constraint_5.f90: Correct code and error. Added: trunk/gcc/testsuite/gfortran.dg/equiv_7.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/resolve.c trunk/gcc/fortran/target-memory.c trunk/gcc/fortran/target-memory.h trunk/gcc/fortran/trans-common.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/equiv_constraint_5.f90 trunk/gcc/testsuite/gfortran.dg/equiv_constraint_7.f90 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30875
[Bug fortran/30875] Equivalence of derived types with (same) default initializer
--- Comment #5 from pault at gcc dot gnu dot org 2007-06-11 22:42 --- Fixed on trunk Paul -- pault at gcc dot gnu dot org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30875
[Bug fortran/30875] Equivalence of derived types with (same) default initializer
--- Comment #3 from pault at gcc dot gnu dot org 2007-05-07 09:45 --- This will be fixed at the same time as PR29786. This, in its turn, is awaiting the fix for PR18769, where Brooks is wading through the necessary gcc modifications. Paul -- pault at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |pault at gcc dot gnu dot org |dot org | Status|NEW |ASSIGNED Last reconfirmed|2007-03-17 23:39:00 |2007-05-07 09:45:54 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30875
[Bug fortran/30875] Equivalence of derived types with (same) default initializer
--- Comment #2 from brooks at gcc dot gnu dot org 2007-03-17 23:39 --- At the end of 14.6.3.3, 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. It is somewhat unclear to me from that language whether the relevant constraint is that A1 and A2 would have to have the same type and type parameters (which they do not, making the code illegal), or whether A1%I and A2%I would have to have the same type and type parameters (which they do, making the code legal). I tried to get some further opinions about this on comp.lang.fortran, but apparently nobody found my question interesting enough to reply to. :) I've now found that MRC describes this condition as being that the components in question must have the same type and type parameters, which would make this legal, and I suspect that's the final answer we'll get. Thus, I'm confirming the bug; I can certainly reproduce the error message. -- brooks at gcc dot gnu dot org changed: What|Removed |Added CC||brooks at gcc dot gnu dot ||org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Known to fail||4.3.0 Last reconfirmed|-00-00 00:00:00 |2007-03-17 23:39:00 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30875
[Bug fortran/30875] Equivalence of derived types with (same) default initializer
--- Comment #1 from burnus at gcc dot gnu dot org 2007-02-20 16:39 --- EQUIVALENCE(a1,a2) 1 Error: Derived type variable 'a1' at (1) with default initializer cannot be an EQUIVALENCE object ffv.f90:11.17: EQUIVALENCE(a1,a2) 1 Error: Initialized objects 'a1' and 'a2' cannot both be in the EQUIVALENCE statement at (1) Compiles with ifort, g95 and nagf95. Observations: If T1 is initialized with 1 and T2 with 2, ifort and nag95 compile it and g95 rejects it with: Memory is initialized more than once (offset 0) If run (both 1): g95: 1 1 nagf95: garbage value (twice) ifort: 1 1 If run with 1, 2: g95: - (does not compile, see above) ifort: 2 2 nagf95: garbage value (twice) -- burnus at gcc dot gnu dot org changed: What|Removed |Added Keywords||rejects-valid Summary|incorrect error message for |Equivalence of derived types |valid code |with (same) default ||initializer http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30875