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/88043] New: Runtime Error when calling deferred member function


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

            Bug ID: 88043
           Summary: Runtime Error when calling deferred member function
           Product: gcc
           Version: 8.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zjibben at gmail dot com
                CC: neil.n.carlson at gmail dot com
  Target Milestone: ---

A call to a deferred member procedure ends up calling a different procedure
instead. It looks like the virtual function table is incorrect when passing
between two source files. I have a small example (~100 lines) in two source
files here:

https://github.com/nncarlson/fortran-compiler-tests/blob/master/gfortran-bugs/gfortran-20181114-main.f90

https://github.com/nncarlson/fortran-compiler-tests/blob/master/gfortran-bugs/gfortran-20181114.f90

In this case, the routine never_call1 is called recursively, despite there
being no real calls to that function. With -fcheck=all this is caught,
otherwise it will consume your entire stack. Compiled using gfortran 8.2.1
20180831:

$ gfortran -g -fcheck=all gfortran-20181114.f90 gfortran-20181114-main.f90
$ ./a.out
At line 39 of file gfortran-20181114.f90
Fortran runtime error: Recursive call to nonrecursive procedure 'never_call1'

Error termination. Backtrace:
#0  0x55b1599cd19d in __foo_class_MOD_never_call1
        at .../gfortran-20181114.f90:39
#1  0x55b1599cd1bc in __foo_class_MOD_never_call1
        at .../gfortran-20181114.f90:42
#2  0x55b1599cd220 in __foo_class_MOD_call_me
        at .../gfortran-20181114.f90:34
#3  0x55b1599cd449 in test
        at .../gfortran-20181114-main.f90:42
#4  0x55b1599cd49f in main
        at .../gfortran-20181114-main.f90:32

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