https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107659
Bug ID: 107659
Summary: C procedure with no global scope is seen as global
Product: gcc
Version: 10.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: urbanjost at comcast dot net
Target Milestone: ---
Created attachment 53886
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53886&action=edit
single file source appears to be required to reproduce the problem
This is reduced from a much larger (>100 000, line) code and is
very sensitive to nearly any change to the remaining file, and
requires everything being in a single file as well to reproduce
reliably. I have workarounds now, but it might be a reproducer
for something more generic. The "remove" C function is required,
which is on Linux/Unix/... machines but not sure if that exists
on MSWindows.
gfortran -c xbug.f90
xbug.f90:42:27:
13 | function c_remove(c_path) bind(c,name="remove") result(c_err)
| 2
......
42 | call remove(self%key)
| 1
Error: Global binding name ‘remove’ at (1) is already being used as a FUNCTION
at (2)
module m_system
use,intrinsic :: iso_c_binding, only : c_int, c_char
use,intrinsic :: iso_fortran_env, only : int32
implicit none
private
public :: CALLC
contains
elemental impure function CALLC(path) result(err)
character(*),intent(in) :: path
integer(c_int) :: err
character(kind=c_char,len=1),allocatable :: temp(:)
interface
function c_remove(c_path) bind(c,name="remove") result(c_err)
import c_char,c_int
character(kind=c_char,len=1),intent(in) :: c_path(*)
integer(c_int) :: c_err
end function
end interface
err= c_remove(temp)
end function CALLC
end module m_system
module m_list
implicit none
private
public remove
interface remove
module procedure remove_char
end interface
public dictionary
type dictionary
character(len=:),allocatable :: key(:)
end type dictionary
contains
subroutine remove_char(list)
character(len=:),allocatable :: list(:)
list=['aaaaa']
end subroutine remove_char
subroutine dict_delete(self,key)
class(dictionary),intent(in) :: self
character(len=*),intent(in) :: key
call remove(self%key)
end subroutine dict_delete
end module m_list