------- Comment #1 from burnus at gcc dot gnu dot org 2007-08-28 10:04 ------- The bug is actually worse as valid Fortran 2003 programs are rejected.
The following program should print "5 -5". The two static global variables are not the same as their binding name is not "a" but something like "__m_MOD_a" and "__n_MOD_a". Somehow the binding is treated wrongly and thus one gets the error: Error: Binding label 'a' at (1) collides with global entity 'a' at (2) With NAG f95 the desired "5 -5" is printed. The program below should behave identically for BIND(C,name="") and without. (Using the variable from C is difficult, but one could think of passing the variable as actual argument or - with TARGET attribute - a pointer to that variable.) module m use iso_c_binding implicit none integer(c_int), save, bind(C, name="") :: a = 5 ! integer(c_int), save :: a = 5 end module m module n use iso_c_binding implicit none integer(c_int), save, bind(C,name="") :: a = -5 ! integer(c_int), save :: a = -5 end module n program prog use m use n, b=>a implicit none print *, a, b end program prog -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid Summary|Bind(C): Accepts multiple |Bind(C): Bugs with empty |entites with same (empty) |"name=": Creates wrong |binding name |result and accepts invalid http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33215