Skip to content

Commit 7c074a4

Browse files
committed
New gfortran bug test case
1 parent e90c986 commit 7c074a4

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

gfortran-bugs/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ include(testing)
55

66
project(gfortran-bug Fortran)
77

8+
add_compiler_test(SOURCES gfortran-20200402-file1.f90 gfortran-20200402-file2.f90
9+
LINK_ONLY LABELS PR94463)
810
add_compiler_test(SOURCES gfortran-20190202.f90 RUN_ONLY LABELS PR89174)
911
add_compiler_test(SOURCES gfortran-20180610.f90 LABELS PR86100
1012
COMPILE_FLAGS "-g -fcheck=bounds")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
! See gfortran-20200402-file2.f90 for description
2+
3+
module scalar_func_class
4+
type, abstract :: scalar_func
5+
end type
6+
end module
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
!! https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94463
2+
!!
3+
!! LINK FAILURE
4+
!!
5+
!! In this example the compiler generates a reference to the undefined
6+
!! symbol __vtab_scalar_func_class_Scalar_func.3804. The example is split
7+
!! across two source files (see gfortran-20200402-file1.f90). Note that
8+
!! the symbol __scalar_func_class_MOD___vtab_scalar_func_class_Scalar_func
9+
!! is defined in gfortran-20200402-file1.o.
10+
!!
11+
!! This failure appears to occur for all versions of gfortran.
12+
!!
13+
!! $ gfortran gfortran-20200402-file1.f90 -c
14+
!! $ gfortran gfortran-20200402-file2.f90 gfortran-20200402-file1.o
15+
!! /usr/bin/ld: /tmp/ccNS7CfH.o: in function `__fubar_MOD_edit_short':
16+
!! gfortran-20200402-file2.f90:(.text+0x1f): undefined reference to `__vtab_scalar_func_class_Scalar_func.3905'
17+
!! /usr/bin/ld: gfortran-20200402-file2.f90:(.text+0x8f): undefined reference to `__vtab_scalar_func_class_Scalar_func.3905'
18+
!! collect2: error: ld returned 1 exit status
19+
!!
20+
21+
module material_model_type
22+
contains
23+
subroutine alloc_phase_prop(func)
24+
use scalar_func_class, only: scalar_func
25+
class(scalar_func), allocatable, intent(out) :: func
26+
end subroutine
27+
end module
28+
29+
module fubar
30+
contains
31+
subroutine edit_short
32+
use material_model_type, only: alloc_phase_prop
33+
use scalar_func_class, only: scalar_func
34+
class(scalar_func), allocatable :: f
35+
call alloc_phase_prop(f)
36+
end subroutine
37+
end module
38+
39+
end

0 commit comments

Comments
 (0)