[Bug fortran/94463] New: Bad object code / reference to undefined symbol

neil.n.carlson at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Apr 3 04:11:47 GMT 2020


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

            Bug ID: 94463
           Summary: Bad object code / reference to undefined symbol
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: neil.n.carlson at gmail dot com
  Target Milestone: ---

In the following example (two files) the compiler is generating a reference to
the undefined symbol __vtab_scalar_func_class_Scalar_func.3804. This is
probably meant to be a reference to the symbol
__scalar_func_class_MOD___vtab_scalar_func_class_Scalar_func
from file1.o

This error is present in all versions I've tried from 7.5, 8.3, to 9.3.

$ cat gfortran-20200402-file1.f90 
module scalar_func_class
  type, abstract :: scalar_func
  end type
end module

$ cat gfortran-20200402-file2.f90 
module material_model_type
contains
  subroutine alloc_phase_prop(func)
    use scalar_func_class, only: scalar_func
    class(scalar_func), allocatable, intent(out) :: func
  end subroutine
end module

module fubar
contains
  subroutine edit_short
    use material_model_type, only: alloc_phase_prop
    use scalar_func_class, only: scalar_func
    class(scalar_func), allocatable :: f
    call alloc_phase_prop(f)
  end subroutine
end module
end

$ gfortran gfortran-20200402-file?.f90
/usr/bin/ld: /tmp/ccAkiCLE.o: in function `__fubar_MOD_edit_short':
gfortran-20200402-file2.f90:(.text+0x1f): undefined reference to
`__vtab_scalar_func_class_Scalar_func.3804'
/usr/bin/ld: gfortran-20200402-file2.f90:(.text+0x8b): undefined reference to
`__vtab_scalar_func_class_Scalar_func.3804'
collect2: error: ld returned 1 exit status


More information about the Gcc-bugs mailing list