From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1DD8F3858C52; Sat, 12 Nov 2022 00:40:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1DD8F3858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668213618; bh=tJPtrzB8PrXg0gJ4QmPvOGtJHQ1cMuNh0TcPiQOHss0=; h=From:To:Subject:Date:From; b=Zz/XoNHVoBAIfUq0zSZxZjTDqJQHsAy+SjKIuW5aT1ay0jY2jpWXgKwLo2PXP+eW6 x4R7+ciY06piy6ict9JVexZsns66JdTLmwKpGNf4uOLxfo+Ak9DqgfpIs1iLUIHYRn oSFBZqrFh0b6CuEVWZaaNGPrnQ6TpCq9h4wgU5w0= From: "urbanjost at comcast dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/107659] New: C procedure with no global scope is seen as global Date: Sat, 12 Nov 2022 00:40:16 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 10.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: urbanjost at comcast dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107659 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=3D53886&action=3Dedit 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=3D"remove") result(c_err) | 2=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20 ...... 42 | call remove(self%key) | 1 Error: Global binding name =E2=80=98remove=E2=80=99 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=3Dc_char,len=3D1),allocatable :: temp(:) interface function c_remove(c_path) bind(c,name=3D"remove") result(c_err) import c_char,c_int character(kind=3Dc_char,len=3D1),intent(in) :: c_path(*) integer(c_int) :: c_err end function end interface err=3D 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=3D:),allocatable :: key(:) end type dictionary contains subroutine remove_char(list) character(len=3D:),allocatable :: list(:) list=3D['aaaaa'] end subroutine remove_char subroutine dict_delete(self,key) class(dictionary),intent(in) :: self character(len=3D*),intent(in) :: key call remove(self%key) end subroutine dict_delete end module m_list=