[Fortran-Experiments]: patch

Christopher D. Rickett crickett@lanl.gov
Mon Feb 26 18:57:00 GMT 2007



On Mon, 26 Feb 2007, Tobias Burnus wrote:

> Hi Chris,
>
> Christopher D. Rickett wrote:
>> I just checked the patch i sent on Feb. 24, and it does include the
>> gfc_verify_binding_labels function, so it should report the above code
>> as an error.  Tobias: i guess i'm not sure why the above is still
>> being accepted by your copy; it's not accepted by my copy of gfortran.
> Here, it is rejected if I put both modules into the same Fortran file: I
> get an error already when compiling the second module. That really works
> well!
>
> But, if I put the two modules in separated files and compile them
> separately (gfortran -c module1.f90; gfortran -c module2.f90; gfortran
> -c main.f90), no error is shown. (There should be one at the second
> "USE" in the main program.)

i think i've fixed this.  now given the following code:

tobias5.f03:
module x
   use iso_c_binding
   implicit none
   integer(c_int), bind(c,name="c_one") :: one
end module x


tobias6.f03:
module y
   use iso_c_binding
   implicit none
   integer(c_int), bind(c,name="c_one") :: one
end module y

program main
   use x
   use y
end program main

$>gfortran -c tobias5.f03
$>gfortran -c tobias6.f03
tobias6.f03:8.7:

   use x
       1
tobias6.f03:4.45:

   integer(c_int), bind(c,name="c_one") :: one
                                             2
Error: Binding label 'c_one' at (1) collides with global entity 'c_one' at 
(2)

i could improve the error message now since i detect the use association, 
if you would like?  i'm going to try and test it with procedures and 
interfaces and then hopefully include it in my next patch.  right now, 
this doesn't break anything that's already handled.

Chris



More information about the Fortran mailing list