public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/107659] New: C procedure with no global scope is seen as global
@ 2022-11-12  0:40 urbanjost at comcast dot net
  2022-11-16 20:53 ` [Bug fortran/107659] " anlauf at gcc dot gnu.org
  2022-11-19 22:14 ` anlauf at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: urbanjost at comcast dot net @ 2022-11-12  0:40 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-19 22:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-12  0:40 [Bug fortran/107659] New: C procedure with no global scope is seen as global urbanjost at comcast dot net
2022-11-16 20:53 ` [Bug fortran/107659] " anlauf at gcc dot gnu.org
2022-11-19 22:14 ` anlauf at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).