https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53478

--- Comment #8 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> The test case in comment 0 and comment 3 are invalid in Fortran 2003;
> I think they are valid in Fortran 2008 (cf. PR 48858 comment 9). However,
> I need a quiet moment to disentangle the standard speak and to create a patch.

From pr56440 comment 3

> In the code, one has a C binding label "test_bug" and the module has
> the same name.
>
> That's invalid per Fortran 2008's
>
> "1.3.116  program unit
> main program, external subprogram, module, submodule, or block data program
> unit (2.2.1)"
>
> "16.2 Global identifiers"
> "Program units, [...] are global entities of a program. [...]
> "The global identifier of an entity shall not be the same as the global
> identifier of any other entity. Furthermore, a binding label shall not be
> the same as the global identifier of any other global entity, ignoring
> differences in case."

The code is now rejected since at least 4.9.3 with

pr53478.f90:7:26:

pr53478.f90:1:14:

 module exports
              2            
pr53478.f90:7:26:

       subroutine f_exports() bind(C, name='exports')
                          1
Error: Procedure f_exports with binding label exports at (1) uses the same
global identifier as entity at (2)

> Note that the current check is case sensitive, i.e. using
> 'bind(C,name="TEST_BUG")' should (also) produce an error.

This is not done yet, also the names should probably use %qs.

Reply via email to