public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32515]  New: F2003: Reject COMMON block names if local symbol already exists
@ 2007-06-26 15:51 burnus at gcc dot gnu dot org
  2007-06-26 15:52 ` [Bug fortran/32515] " 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-06-26 15:51 UTC (permalink / raw)
  To: gcc-bugs

! F95: 14.1.2.1:
! "A common block name in a scoping unit also may be the name of any local
!  entity other than a named constant, intrinsic procedure, or a local variable
!  that is also an external function in a function subprogram."
!
! F2003: 16.2.1
! "A name that identifies a common block in a scoping unit shall not be used
!  to identify a constant or an intrinsic procedure in that scoping unit. If
!  a local identifier is also the name of a common block, the appearance of
!  that name in any context other than as a common block name in a COMMON
!  or SAVE statement is an appearance of the local identifier."

Currently, valid Fortran 2003 programs are therefore rejected. The check
happens very early in the match.c's gfc_match_common ("Symbol '%s' at %C is
already an external symbol that is not COMMON").


-- 
           Summary: F2003: Reject COMMON block names if local symbol already
                    exists
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org
 BugsThisDependsOn: 25062


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/32515] F2003: Reject COMMON block names if local symbol already exists
  2007-06-26 15:51 [Bug fortran/32515] New: F2003: Reject COMMON block names if local symbol already exists burnus at gcc dot gnu dot org
@ 2007-06-26 15:52 ` burnus at gcc dot gnu dot org
  2007-07-03 10:38 ` fxcoudert 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-06-26 15:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-06-26 15:52 -------
Created an attachment (id=13792)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13792&action=view)
Test case

I believe the attached program is valid in Fortran 2003 (modulo typos; as no
compiler accepts it, I cannot test it).


-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/32515] F2003: Reject COMMON block names if local symbol already exists
  2007-06-26 15:51 [Bug fortran/32515] New: F2003: Reject COMMON block names if local symbol already exists burnus at gcc dot gnu dot org
  2007-06-26 15:52 ` [Bug fortran/32515] " burnus at gcc dot gnu dot org
@ 2007-07-03 10:38 ` fxcoudert at gcc dot gnu dot org
  2010-05-09 18:59 ` dfranke at gcc dot gnu dot org
  2010-05-10 17:35 ` mikael at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-07-03 10:38 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert 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-07-03 10:38:24
               date|                            |


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/32515] F2003: Reject COMMON block names if local symbol already exists
  2007-06-26 15:51 [Bug fortran/32515] New: F2003: Reject COMMON block names if local symbol already exists burnus at gcc dot gnu dot org
  2007-06-26 15:52 ` [Bug fortran/32515] " burnus at gcc dot gnu dot org
  2007-07-03 10:38 ` fxcoudert at gcc dot gnu dot org
@ 2010-05-09 18:59 ` dfranke at gcc dot gnu dot org
  2010-05-10 17:35 ` mikael at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-09 18:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dfranke at gcc dot gnu dot org  2010-05-09 18:58 -------
With two minor modifications to the code (in main, call func(), not res(); in
func1() call modFunc(), not mod), one gets:

$> gfortran-svn -v
gcc version 4.6.0 20100509 (experimental) (GCC) 

$> gfortran-svn -Wall -W -std=f95 pr32515.f90 
pr32515.f90:24.16:

    common /bar/ r2 ! F95: Error also a global procedure
                1
Error: Symbol 'bar' at (1) is already an external symbol that is not COMMON
pr32515.f90:25.16:

    common /mod/ r3 ! F95: Error also a global procedure
                1
Error: Symbol 'mod' at (1) is already an external symbol that is not COMMON
pr32515.f90:23.16:

    common /res/ r1 ! F95: Error also a global procedure
                1
Error: Fortran 2003: COMMON block 'res' at (1) that is also a function result


$> gfortran-svn -Wall -W -std=f2003 pr32515.f90 
pr32515.f90:24.16:

    common /bar/ r2 ! F95: Error also a global procedure
                1
Error: Symbol 'bar' at (1) is already an external symbol that is not COMMON
pr32515.f90:25.16:

    common /mod/ r3 ! F95: Error also a global procedure
                1
Error: Symbol 'mod' at (1) is already an external symbol that is not COMMON


I think, that's ok, Closing.
Please reopen if I misread something.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/32515] F2003: Reject COMMON block names if local symbol already exists
  2007-06-26 15:51 [Bug fortran/32515] New: F2003: Reject COMMON block names if local symbol already exists burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2010-05-09 18:59 ` dfranke at gcc dot gnu dot org
@ 2010-05-10 17:35 ` mikael at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mikael at gcc dot gnu dot org @ 2010-05-10 17:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from mikael at gcc dot gnu dot org  2010-05-10 17:35 -------
If I understand correctly, an external symbol can be used for a common block
name in f2003. 
Thus, there should be no error with -std=f2003. 


-- 

mikael at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-05-10 17:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-26 15:51 [Bug fortran/32515] New: F2003: Reject COMMON block names if local symbol already exists burnus at gcc dot gnu dot org
2007-06-26 15:52 ` [Bug fortran/32515] " burnus at gcc dot gnu dot org
2007-07-03 10:38 ` fxcoudert at gcc dot gnu dot org
2010-05-09 18:59 ` dfranke at gcc dot gnu dot org
2010-05-10 17:35 ` mikael 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).