This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Fortran-Experiments]: patch for error checking on binding labels and derived types, etc.




-----------------------------------
module one
contains
 subroutine foo() bind(c)
 end subroutine foo
end module one

module two
contains
 ! This procedure is only used accessed in C
 ! as procedural pointer
 subroutine foo() bind(c, name="")
 end subroutine foo
end module two

use one, only: foo_one => foo
use two, only: foo_two => foo
end
-----------------------------------


By the way, the example above does not work in gfortran:


bar.f90:14.29:
use two, only: foo_two => foo
                           1
bar.f90:3.16:
 subroutine foo() bind(c)
              2
Error: Binding label 'foo' at (1) collides with the global entity 'foo'
at (2)

i'll have to look at that. thanks for the new test case. the binding label verification definitely doesn't seem like the easiest thing to enforce. yesterday, i worked on adding it for common blocks, which are a bit more complicated than other symbols. i have a patch for them that i'm nearly ready to submit that should be a good start.



i found what seemed to be causing this and i think i've fixed it. there were a couple problems. first, gfc_verify_binding_labels wasn't ignoring bind(c) symbols that have no binding label, and second, there was still a *safety check* in module.c:write_symbol() that checked that the binding label was not nil. with these two changes, the above code is accepted, and my previous tests still work as expected. it'll be in my next patch.


thanks for the bug report.
Chris


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]