This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/77746] New: [5 Regression] Wrong subroutine called, clash of specific procedure name and binding-name


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

            Bug ID: 77746
           Summary: [5 Regression] Wrong subroutine called, clash of
                    specific procedure name and binding-name
           Product: gcc
           Version: 5.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vladimir.fuka at gmail dot com
  Target Milestone: ---

This program finishes successfully with 4.9 and crashes with 5.3.1

The generic resolution selects wrong procedure. The calling procedure happens
to have the same binding-name as the name of the correct specific procedure and
gets called recursively instead of the correct one.

See also similar: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66695 (I have
already 15 still open bugs in gfortran and this is the 16th!)

Output:

> gfortran-5 bug1.F90 
> ./a.out 
Segmentation fault

> gfortran-5 -fcheck=all bug1.F90 
> ./a.out 
At line 22 of file bug1.F90
Fortran runtime error: Recursive call to nonrecursive procedure 'p_execute'



module first
  private
  public execute

  interface execute
    module procedure random_name
  end interface

contains

  subroutine random_name()
  end subroutine
end module

module test
  use first

  implicit none

contains

  subroutine p_execute(i)  bind(C, name="random_name")
    integer :: i

    call execute()
  end subroutine

end module

  use test
  call p_execute(1)
end

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]