[Bug fortran/82923] New: Automatic allocation of deferred length character using function result
werner.blokbuster at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Nov 9 16:43:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82923
Bug ID: 82923
Summary: Automatic allocation of deferred length character
using function result
Product: gcc
Version: 7.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: werner.blokbuster at gmail dot com
Target Milestone: ---
I can't believe that this isn't a duplicate although I can't find it. The
following code gives an ICE for me on gfortran 7.2, if the line
mine=getchars(2,4) is included:
module m
implicit none
contains
function getchars(my_len,my_size)
integer, intent(in) :: my_len, my_size
character(my_len) :: getchars(my_size)
getchars = 'A-'
end function getchars
end module m
program testca
use m, only: getchars
implicit none
character(:), allocatable :: mine(:)
! this works:
write(*,*) getchars(2,4)
write(*,*) len(getchars(2,4))
write(*,*) size(getchars(2,4))
! this works:
mine = [character(2) :: 'A-','A-']
write(*,*) mine
! ICE occurs if this line is included:
mine = getchars(2,4)
end program testca
WB
More information about the Gcc-bugs
mailing list