Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

ICE - character allocation

Alexis_R_
New Contributor I
527 Views
The following triggers an ICE with ifort 12:
[fortran]subroutine test1
 character(len=:), allocatable :: string
 character(len=20) :: word
 !
 word = 'hello'
 allocate(character(len=len_trim(word)) :: string)
 print *, 'allocated string with length ', len(string)
end subroutine test1[/fortran]
But the following compiles just fine:
[fortran]subroutine test2
 character(len=:), allocatable :: string
 character(len=20) :: word
 integer :: ilen
 !
 word = 'hello'
 ilen = len_trim(word)
 allocate(character(len=ilen) :: string)
 print *, 'allocated string with length ', len(string)
end subroutine test2[/fortran]
0 Kudos
2 Replies
Ron_Green
Moderator
527 Views
that is indeed a bug. I'll get a bug report started.

thanks for sending this in.

Bug ID DPD200164879

ron
0 Kudos
Ron_Green
Moderator
527 Views
this bug has been fixed in 12.1 Update 6.

ron
0 Kudos
Reply