[Bug fortran/48858] Incorrect error for same binding label on two generic interface specifics
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun May 22 14:41:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48858
--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-05-22 14:17:45 UTC ---
The OPTIONAL problem is solved by allowing OPTIONAL with -std=gnu (default) and
-std=f2008tr.
Regarding the original problem: I think I have convince myself that having two
procedures with the same binding label (and a different) interface is valid
according to the standard.
One probably could check that the number of arguments is the same and warn
otherwise. (For variadic arguments, the number of arguments can vary, but
calling a variadic function from Fortran has some potential issues and is also
invalid. Passing too many arguments should work, but is with stdcall
problematic.)
The general diagnostic might be better hidden behind some -W arning flag.
* * *
For a similar report and patch, cf
http://gcc.gnu.org/ml/fortran/2011-05/msg00154.html
Regarding that patch: I think it disables the error if one item is a procedure
and one is a variable/derived type. (I have not checked, though.)
* * *
The current check is in any case too tight. The following is perfectly valid:
(Same interface, same binding label, but different procedure name.)
interface
subroutine foo() bind(C, name="foo")
end subroutine foo
end interface
end
subroutine test
interface
subroutine bar() bind(C, name="foo")
end subroutine bar
end interface
end subroutine test
More information about the Gcc-bugs
mailing list