public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/33152] New: Initialization/declaration problems in block data
@ 2007-08-22 22:34 ruedas at dtm dot ciw dot edu
2007-08-23 0:09 ` [Bug fortran/33152] " kargl at gcc dot gnu dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: ruedas at dtm dot ciw dot edu @ 2007-08-22 22:34 UTC (permalink / raw)
To: gcc-bugs
The following four variants of declarations have been tried in a block
data statement with gfortran 4.1.3 and partly also with 4.3.0:
Var. 1:
character(len=3) :: emname(nmin)=(/'bar','baz'/)
common/nmstr/emname
gives this error:
In file test.f90:16
common/nmstr/emname
1
Error: Previously initialized symbol 'emname' in COMMON block 'nmstr'
at (1)
Var. 2:
common/nmstr/emname
character(len=3) :: emname(nmin)=(/'bar','baz'/)
gives this error:
In file test.f90:19
character(len=3) :: emname(nmin)=(/'bar','baz'/)
1
Error: Initializer not allowed for COMMON variable 'emname' at (1)
In file test.f90:16
common/nmstr/emname
1
Error: Symbol 'emname' at (1) has no IMPLICIT type
Var. 3:
common/nmstr/emname
data emname/'bar','baz'/
character(len=3) :: emname(nmin)
gives this error:
test.f90:1: internal compiler error: in check_data_variable, at
fortran/resolve.c:5865
Please submit a full bug report,
with preprocessed source if appropriate.
Var. 4:
character(len=3) :: emname(nmin) !=(/'bar','baz'/)
common/nmstr/emname
data emname/'bar','baz'/
works.
My question is this: I thought all four variants are compliant with the
standard. Which ones are possibly not, and where does gfortran indeed have a
bug? Var. 1 worked with the Intel compiler; I didn't/can't test the others. The
complete test program is below (comment/uncomment some lines as applicable). My
system is SUSE Linux 10.2.
program foo
implicit none
integer, parameter :: nmin=2
double precision :: rho0(nmin)
common/phasedat/rho0
end program foo
block data thdinit
implicit none
integer, parameter :: nmin=2
!double precision :: rho0(nmin)
common/phasedat/rho0
double precision :: rho0(nmin)
character(len=3) :: emname(nmin) !=(/'bar','baz'/)
common/nmstr/emname
data emname/'bar','baz'/
!character(len=3) :: emname(nmin)=(/'bar','baz'/)
end block data thdinit
--
Summary: Initialization/declaration problems in block data
Product: gcc
Version: 4.1.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ruedas at dtm dot ciw dot edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33152
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/33152] Initialization/declaration problems in block data
2007-08-22 22:34 [Bug fortran/33152] New: Initialization/declaration problems in block data ruedas at dtm dot ciw dot edu
@ 2007-08-23 0:09 ` kargl at gcc dot gnu dot org
2007-10-21 7:30 ` pault at gcc dot gnu dot org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: kargl at gcc dot gnu dot org @ 2007-08-23 0:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from kargl at gcc dot gnu dot org 2007-08-23 00:09 -------
It's much worse than you've indicated. :(
gfortran compiles
subroutine y
data emname/'bar'/
character(len=3) :: emname
end subroutine y
which violates "A variable that appears in a DATA statement and has not
been typed previously may appear in a subsequent type declaration only if
that declaration confirms the implicit typing." See 5.2.10.
The ICE in your Var. 3 occurs in this simplified code
subroutine z
integer, parameter :: nmin=2
data emname/'bar','baz'/
character(len=3) :: emname(nmin)
end subroutine z
so the fact that we've changed to an array of strings isn't
handled correctly. I think an error should occur here because
"An array name, array section, or array element that appears in a
DATA statement shall have had its array properties established by
a previous specification statement." See 5.2.10. That is, the order
of the statements is wrong.
Your variations 1 and 2 should be legal via 5.5.2.4(3): "A data object
in a named common block may be initially defined by means of a DATA
statement or type declaration statement in a block data program unit
(11.4), but objects in blank common shall not be initially defined."
It seems gfortran is ignoring the "block data program unit" part of
the above.
--
kargl at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33152
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/33152] Initialization/declaration problems in block data
2007-08-22 22:34 [Bug fortran/33152] New: Initialization/declaration problems in block data ruedas at dtm dot ciw dot edu
2007-08-23 0:09 ` [Bug fortran/33152] " kargl at gcc dot gnu dot org
@ 2007-10-21 7:30 ` pault at gcc dot gnu dot org
2007-10-22 7:03 ` jv244 at cam dot ac dot uk
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-10-21 7:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pault at gcc dot gnu dot org 2007-10-21 07:30 -------
Given Steve's comment, this clearly should be confirmed!
Paul
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-10-21 07:30:20
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33152
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/33152] Initialization/declaration problems in block data
2007-08-22 22:34 [Bug fortran/33152] New: Initialization/declaration problems in block data ruedas at dtm dot ciw dot edu
2007-08-23 0:09 ` [Bug fortran/33152] " kargl at gcc dot gnu dot org
2007-10-21 7:30 ` pault at gcc dot gnu dot org
@ 2007-10-22 7:03 ` jv244 at cam dot ac dot uk
2007-11-25 3:28 ` jvdelisle at gcc dot gnu dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jv244 at cam dot ac dot uk @ 2007-10-22 7:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jv244 at cam dot ac dot uk 2007-10-22 07:03 -------
Just to be sure, it is a rejects-valid as well.
BLOCK DATA
character(len=3) :: emname(2)=(/'bar','baz'/)
common/nmstr/emname
END BLOCK DATA
END
--
jv244 at cam dot ac dot uk changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33152
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/33152] Initialization/declaration problems in block data
2007-08-22 22:34 [Bug fortran/33152] New: Initialization/declaration problems in block data ruedas at dtm dot ciw dot edu
` (2 preceding siblings ...)
2007-10-22 7:03 ` jv244 at cam dot ac dot uk
@ 2007-11-25 3:28 ` jvdelisle at gcc dot gnu dot org
2007-11-25 15:58 ` jvdelisle at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-11-25 3:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jvdelisle at gcc dot gnu dot org 2007-11-25 03:28 -------
I have a patch on its way.
--
jvdelisle at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jvdelisle at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2007-10-21 07:30:20 |2007-11-25 03:28:44
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33152
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/33152] Initialization/declaration problems in block data
2007-08-22 22:34 [Bug fortran/33152] New: Initialization/declaration problems in block data ruedas at dtm dot ciw dot edu
` (3 preceding siblings ...)
2007-11-25 3:28 ` jvdelisle at gcc dot gnu dot org
@ 2007-11-25 15:58 ` jvdelisle at gcc dot gnu dot org
2007-11-25 17:22 ` jvdelisle at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-11-25 15:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jvdelisle at gcc dot gnu dot org 2007-11-25 15:58 -------
Subject: Bug 33152
Author: jvdelisle
Date: Sun Nov 25 15:57:55 2007
New Revision: 130409
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130409
Log:
2007-11-25 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/33152
* gfortran.texi: Document default forms assumed for various file
extensions.
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/gfortran.texi
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33152
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/33152] Initialization/declaration problems in block data
2007-08-22 22:34 [Bug fortran/33152] New: Initialization/declaration problems in block data ruedas at dtm dot ciw dot edu
` (4 preceding siblings ...)
2007-11-25 15:58 ` jvdelisle at gcc dot gnu dot org
@ 2007-11-25 17:22 ` jvdelisle at gcc dot gnu dot org
2007-11-25 22:12 ` jvdelisle at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-11-25 17:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jvdelisle at gcc dot gnu dot org 2007-11-25 17:22 -------
oops, I had the wrong PR number in the ChangeLog. Should have been for PR34175.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33152
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/33152] Initialization/declaration problems in block data
2007-08-22 22:34 [Bug fortran/33152] New: Initialization/declaration problems in block data ruedas at dtm dot ciw dot edu
` (5 preceding siblings ...)
2007-11-25 17:22 ` jvdelisle at gcc dot gnu dot org
@ 2007-11-25 22:12 ` jvdelisle at gcc dot gnu dot org
2007-11-25 22:15 ` jvdelisle at gcc dot gnu dot org
2007-11-25 23:51 ` jvdelisle at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-11-25 22:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jvdelisle at gcc dot gnu dot org 2007-11-25 22:12 -------
Subject: Bug 33152
Author: jvdelisle
Date: Sun Nov 25 22:12:19 2007
New Revision: 130415
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130415
Log:
2007-11-25 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/33152
* decl.c (add_init_expr_to_sym): Remove error message.
* resolve.c (check_data_variable): Add new check for a data variable
that has an array spec, but no ref and issue an error.
* match.c (gfc_match_common): Remove error message.
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/decl.c
trunk/gcc/fortran/match.c
trunk/gcc/fortran/resolve.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33152
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/33152] Initialization/declaration problems in block data
2007-08-22 22:34 [Bug fortran/33152] New: Initialization/declaration problems in block data ruedas at dtm dot ciw dot edu
` (6 preceding siblings ...)
2007-11-25 22:12 ` jvdelisle at gcc dot gnu dot org
@ 2007-11-25 22:15 ` jvdelisle at gcc dot gnu dot org
2007-11-25 23:51 ` jvdelisle at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-11-25 22:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from jvdelisle at gcc dot gnu dot org 2007-11-25 22:15 -------
Subject: Bug 33152
Author: jvdelisle
Date: Sun Nov 25 22:14:57 2007
New Revision: 130416
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130416
Log:
2007-11-25 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/33152
*gfortran.dg\blockdata_4.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/blockdata_4.f90
Modified:
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33152
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/33152] Initialization/declaration problems in block data
2007-08-22 22:34 [Bug fortran/33152] New: Initialization/declaration problems in block data ruedas at dtm dot ciw dot edu
` (7 preceding siblings ...)
2007-11-25 22:15 ` jvdelisle at gcc dot gnu dot org
@ 2007-11-25 23:51 ` jvdelisle at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-11-25 23:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jvdelisle at gcc dot gnu dot org 2007-11-25 23:51 -------
Fixed on trunk.
--
jvdelisle at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33152
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-11-25 23:51 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-22 22:34 [Bug fortran/33152] New: Initialization/declaration problems in block data ruedas at dtm dot ciw dot edu
2007-08-23 0:09 ` [Bug fortran/33152] " kargl at gcc dot gnu dot org
2007-10-21 7:30 ` pault at gcc dot gnu dot org
2007-10-22 7:03 ` jv244 at cam dot ac dot uk
2007-11-25 3:28 ` jvdelisle at gcc dot gnu dot org
2007-11-25 15:58 ` jvdelisle at gcc dot gnu dot org
2007-11-25 17:22 ` jvdelisle at gcc dot gnu dot org
2007-11-25 22:12 ` jvdelisle at gcc dot gnu dot org
2007-11-25 22:15 ` jvdelisle at gcc dot gnu dot org
2007-11-25 23:51 ` jvdelisle 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).