Skip to content

Commit 5de50a7

Browse files
committed
New gfortran bug test case
1 parent f60d1c2 commit 5de50a7

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

gfortran-bugs/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ include(testing)
55

66
project(gfortran-bug Fortran)
77

8+
add_compiler_test(SOURCES gfortran-20201204.f90 RUN_ONLY LABELS PR98141)
89
add_compiler_test(SOURCES gfortran-20200501.f90 COMPILE_ONLY LABELS PR94909)
910
add_compiler_test(SOURCES gfortran-20200402-file1.f90 gfortran-20200402-file2.f90
1011
LINK_ONLY LABELS PR94463)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
module foo
2+
3+
type, public :: any_scalar
4+
class(*), allocatable :: value
5+
contains
6+
procedure :: alloc
7+
end type
8+
9+
contains
10+
11+
subroutine alloc (this, value)
12+
class(any_scalar), intent(out) :: this
13+
class(*), intent(in) :: value
14+
allocate(this%value, source=value)
15+
end subroutine alloc
16+
17+
end module foo
18+
19+
20+
program prog
21+
22+
use foo
23+
24+
type(any_scalar) :: s1, s2, s3
25+
character(len=0) :: c
26+
27+
!! No problem
28+
call s1%alloc(' ')
29+
30+
!! Segfault
31+
call s2%alloc('')
32+
33+
!! Segfault
34+
call s3%alloc(c)
35+
36+
end program

0 commit comments

Comments
 (0)