public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30875] New: incorrect error message for valid code
@ 2007-02-20 7:51 jv244 at cam dot ac dot uk
2007-02-20 16:39 ` [Bug fortran/30875] Equivalence of derived types with (same) default initializer burnus at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: jv244 at cam dot ac dot uk @ 2007-02-20 7:51 UTC (permalink / raw)
To: gcc-bugs
With recent trunk, gfortran incorrectly generates an error for the following
standard code:
TYPE T1
sequence
integer :: i=1
END TYPE T1
TYPE T2
sequence
integer :: i=1
END TYPE T2
TYPE(T1) :: a1
TYPE(T2) :: a2
EQUIVALENCE(a1,a2)
write(6,*) a1,a2
END
--
Summary: incorrect error message for valid code
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jv244 at cam dot ac dot uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30875
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/30875] Equivalence of derived types with (same) default initializer
2007-02-20 7:51 [Bug fortran/30875] New: incorrect error message for valid code jv244 at cam dot ac dot uk
@ 2007-02-20 16:39 ` burnus at gcc dot gnu dot org
2007-03-17 23:39 ` brooks at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-02-20 16:39 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/30875] Equivalence of derived types with (same) default initializer
2007-02-20 7:51 [Bug fortran/30875] New: incorrect error message for valid code jv244 at cam dot ac dot uk
2007-02-20 16:39 ` [Bug fortran/30875] Equivalence of derived types with (same) default initializer burnus at gcc dot gnu dot org
@ 2007-03-17 23:39 ` brooks at gcc dot gnu dot org
2007-05-07 8:46 ` pault at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: brooks at gcc dot gnu dot org @ 2007-03-17 23:39 UTC (permalink / raw)
To: gcc-bugs
------- 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 MR&C 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|0000-00-00 00:00:00 |2007-03-17 23:39:00
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30875
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/30875] Equivalence of derived types with (same) default initializer
2007-02-20 7:51 [Bug fortran/30875] New: incorrect error message for valid code jv244 at cam dot ac dot uk
2007-02-20 16:39 ` [Bug fortran/30875] Equivalence of derived types with (same) default initializer burnus at gcc dot gnu dot org
2007-03-17 23:39 ` brooks at gcc dot gnu dot org
@ 2007-05-07 8:46 ` pault at gcc dot gnu dot org
2007-06-11 22:39 ` pault at gcc dot gnu dot org
2007-06-11 22:42 ` pault at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-05-07 8:46 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/30875] Equivalence of derived types with (same) default initializer
2007-02-20 7:51 [Bug fortran/30875] New: incorrect error message for valid code jv244 at cam dot ac dot uk
` (2 preceding siblings ...)
2007-05-07 8:46 ` pault at gcc dot gnu dot org
@ 2007-06-11 22:39 ` pault at gcc dot gnu dot org
2007-06-11 22:42 ` pault at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-06-11 22:39 UTC (permalink / raw)
To: gcc-bugs
------- 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=gcc&view=rev&rev=125628
Log:
2007-06-12 Paul Thomas <pault@gcc.gnu.org>
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 <pault@gcc.gnu.org>
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/30875] Equivalence of derived types with (same) default initializer
2007-02-20 7:51 [Bug fortran/30875] New: incorrect error message for valid code jv244 at cam dot ac dot uk
` (3 preceding siblings ...)
2007-06-11 22:39 ` pault at gcc dot gnu dot org
@ 2007-06-11 22:42 ` pault at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-06-11 22:42 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-06-11 22:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-20 7:51 [Bug fortran/30875] New: incorrect error message for valid code jv244 at cam dot ac dot uk
2007-02-20 16:39 ` [Bug fortran/30875] Equivalence of derived types with (same) default initializer burnus at gcc dot gnu dot org
2007-03-17 23:39 ` brooks at gcc dot gnu dot org
2007-05-07 8:46 ` pault at gcc dot gnu dot org
2007-06-11 22:39 ` pault at gcc dot gnu dot org
2007-06-11 22:42 ` pault at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).