public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34227] New: initialized symbol in common: Better error message
@ 2007-11-25 19:51 burnus at gcc dot gnu dot org
2007-11-25 21:20 ` [Bug fortran/34227] initialized symbol in COMMON: Missing checks burnus at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-11-25 19:51 UTC (permalink / raw)
To: gcc-bugs
character(len=3) :: emname(nmin)=(/'bar','baz'/)
common/nmstr/emname
end
currently gfortran prints:
Error: Previously initialized symbol 'emname' in COMMON block 'nmstr' at (1)
If find the error message of NAG f95 better, which mentions that BLOCK DATA can
be used:
Error: EMNAME has been initialised - can only be COMMON in BLOCK DATA
--
Summary: initialized symbol in common: Better error message
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: enhancement
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34227
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/34227] initialized symbol in COMMON: Missing checks
2007-11-25 19:51 [Bug fortran/34227] New: initialized symbol in common: Better error message burnus at gcc dot gnu dot org
@ 2007-11-25 21:20 ` burnus at gcc dot gnu dot org
2007-11-28 1:01 ` jvdelisle at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-11-25 21:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from burnus at gcc dot gnu dot org 2007-11-25 21:20 -------
That error message disappears with the patch to PR 33152.
>From "5.5.2.4 Differences between named common and blank common":
"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.3), but objects in blank common shall not be initially defined."
The initialization of common blocks outside block-data program units is
supported by several compilers and thus one can consider allowing it for
-std=gnu.
program main
implicit none
integer, parameter:: nmin = 2
character(len=3) :: emname(nmin)=(/'bar','baz'/)
common/nmstr/emname
end program main
As NAG f95 kindly writes:
EMNAME has been initialised - can only be COMMON in BLOCK DATA
ifort -stand f95 diagnoses:
In Fortran 95, this DATA statement object cannot appear in either a blank
COMMON block or a named COMMON block.
but I like the mentioning of DATA BLOCK more.
Same, but with DATA:
program main
implicit none
integer, parameter:: nmin = 2
character(len=3) :: emname(nmin)
data emname/ 'bar','baz' /
common/nmstr/emname
end program main
And for blank commons:
program main
implicit none
integer, parameter:: nmin = 2
character(len=3) :: emname(nmin) = [ 'Aaa','aaa']
common//emname
end program main
gfortran (w/o patch):
Previously initialized symbol 'emname' in blank COMMON block at (1)
Similarly to above, gfortran misses the initialization with DATA. (With the
patch, neither diagnosed):
program main
implicit none
integer, parameter:: nmin = 2
character(len=3) :: emname(nmin)
data emname/ 'bar','baz' /
common//emname
end program main
Note: For blank commons, one should not point to BLOCK DATA as they are not
allowed there. gfortran (patched and unpatched) correctly diagnoses (default
options):
Warning: BLOCK DATA unit cannot contain blank COMMON
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|enhancement |normal
Keywords| |accepts-invalid
Summary|initialized symbol in |initialized symbol in
|common: Better error message|COMMON: Missing checks
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34227
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/34227] initialized symbol in COMMON: Missing checks
2007-11-25 19:51 [Bug fortran/34227] New: initialized symbol in common: Better error message burnus at gcc dot gnu dot org
2007-11-25 21:20 ` [Bug fortran/34227] initialized symbol in COMMON: Missing checks burnus at gcc dot gnu dot org
@ 2007-11-28 1:01 ` jvdelisle at gcc dot gnu dot org
2007-11-28 1:09 ` jvdelisle at gcc dot gnu dot org
2007-11-28 4:26 ` jvdelisle at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-11-28 1:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jvdelisle at gcc dot gnu dot org 2007-11-28 01:01 -------
Subject: Bug 34227
Author: jvdelisle
Date: Wed Nov 28 01:00:50 2007
New Revision: 130483
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130483
Log:
2007-11-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/34227
* match.c (gfc_match_common): Add additional check for BLOCK DATA.
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/match.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34227
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/34227] initialized symbol in COMMON: Missing checks
2007-11-25 19:51 [Bug fortran/34227] New: initialized symbol in common: Better error message burnus at gcc dot gnu dot org
2007-11-25 21:20 ` [Bug fortran/34227] initialized symbol in COMMON: Missing checks burnus at gcc dot gnu dot org
2007-11-28 1:01 ` jvdelisle at gcc dot gnu dot org
@ 2007-11-28 1:09 ` jvdelisle at gcc dot gnu dot org
2007-11-28 4:26 ` jvdelisle at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-11-28 1:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jvdelisle at gcc dot gnu dot org 2007-11-28 01:09 -------
Subject: Bug 34227
Author: jvdelisle
Date: Wed Nov 28 01:09:35 2007
New Revision: 130486
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130486
Log:
2007-11-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/34227
* gfortran.dg/blockdata_5.f90: New test.
* gfortran.dg/blockdata_6.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/blockdata_5.f90
trunk/gcc/testsuite/gfortran.dg/blockdata_6.f90
Modified:
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34227
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/34227] initialized symbol in COMMON: Missing checks
2007-11-25 19:51 [Bug fortran/34227] New: initialized symbol in common: Better error message burnus at gcc dot gnu dot org
` (2 preceding siblings ...)
2007-11-28 1:09 ` jvdelisle at gcc dot gnu dot org
@ 2007-11-28 4:26 ` jvdelisle at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-11-28 4:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jvdelisle at gcc dot gnu dot org 2007-11-28 04:26 -------
Fixed on trunk
--
jvdelisle at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34227
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-11-28 4:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-25 19:51 [Bug fortran/34227] New: initialized symbol in common: Better error message burnus at gcc dot gnu dot org
2007-11-25 21:20 ` [Bug fortran/34227] initialized symbol in COMMON: Missing checks burnus at gcc dot gnu dot org
2007-11-28 1:01 ` jvdelisle at gcc dot gnu dot org
2007-11-28 1:09 ` jvdelisle at gcc dot gnu dot org
2007-11-28 4:26 ` 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).