Created
June 14, 2025 20:19
-
-
Save krystophny/b1e1785249eacc188aa2851ed6fbe471 to your computer and use it in GitHub Desktop.
GFortran 15 bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program grow_type_array | |
type :: string_t | |
character(:), allocatable :: s | |
end type string_t | |
type(string_t) :: str | |
type(string_t), allocatable :: list(:) | |
! This works | |
allocate(list(0)) | |
str = new_string("Hello!") | |
list = [list, str] | |
deallocate(list) | |
! This segfaults on gfortran 15.1 but works on gfortran 14 | |
! when using -fcoarray=single compile flag | |
allocate(list(0)) | |
list = [list, new_string("Hello!")] | |
contains | |
type(string_t) function new_string(s) result(out) | |
character(*), intent(in) :: s | |
out%s = s | |
end function new_string | |
end program grow_type_array |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fails with
Leaving out
-fcoarray=single
or usinggfortran 14
causes no error.