Bug 35161 - [F2008] allow procedures with same binding label (invalid in F2003)
Summary: [F2008] allow procedures with same binding label (invalid in F2003)
Status: RESOLVED DUPLICATE of bug 48858
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
: 35172 38386 41704 (view as bug list)
Depends on:
Blocks: 32630 39627
  Show dependency treegraph
 
Reported: 2008-02-11 08:54 UTC by Tobias Burnus
Modified: 2012-01-07 22:15 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-01-03 23:00:16


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2008-02-11 08:54:52 UTC
I think it is formally valid to have multiple times the same C binding label (at least for procedures). At least I cannot find anything in the standard which says otherwise.

Currently, both gfortran and NAG f95 reject the following program while g95 and ifort accept it.

See also question posted at:
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/b1e8c8d0af9d16e8/
(when writing this, the question was not yet answered)

NAG f95:
Error: aaa.f90: Duplicate binding label 'xxx' for external procedure XXX_1 and external procedure XXX_2

gfortran:
Error: Binding label 'xxx' in interface body at (1) collides with the global entity 'xxx' at (2)

interface xxx
    integer function xxx_1( y ) bind( c, name = "xxx" )
        use iso_c_binding
        real(c_float), intent(inout) :: y
    end function
    integer function xxx_2( y ) bind( c, name = "xxx" )
        use iso_c_binding
        real(c_float), intent(inout), dimension(*) :: y
    end function
end interface
end
Comment 1 Daniel Franke 2008-02-12 20:05:25 UTC
*** Bug 35172 has been marked as a duplicate of this bug. ***
Comment 2 Daniel Franke 2009-01-03 23:00:15 UTC
(In reply to comment #0)
> See also question posted at:
> http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/b1e8c8d0af9d16e8/
> (when writing this, the question was not yet answered)

Conclusion at c.l.f:
"the standard does not require the compiler to issue a message
about names associated to BIND(C,name=...). However I like to see
gfortran reporting that two C names coincide."

Confirmed.
Comment 3 Daniel Franke 2009-01-04 00:48:59 UTC
See also: PR38386.
Comment 4 Daniel Franke 2010-05-09 13:14:50 UTC
*** Bug 41704 has been marked as a duplicate of this bug. ***
Comment 5 Daniel Franke 2010-05-09 14:08:00 UTC
*** Bug 38386 has been marked as a duplicate of this bug. ***
Comment 6 Daniel Franke 2010-05-09 14:10:02 UTC
Adjusted summary to match information given in dupes.
Comment 7 Tobias Burnus 2012-01-07 22:15:51 UTC
Mark as duplicate of PR 48858 - which has in PR 48858 comment 9 a better description why it is valid in F2008 - and links to an IR which confirms the invalidity in F2003.

*** This bug has been marked as a duplicate of bug 48858 ***