[Bug fortran/67564] Segfault on sourced allocattion statement with class(*) arrays
neil.n.carlson at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Mar 22 02:31:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67564
--- Comment #10 from neil.n.carlson at gmail dot com ---
Here's another example, but in this case the bad, source-allocated class(*)
variable is just a local variable. It is rank-2 however.
character(:), allocatable :: array(:,:)
array = reshape(['foo','bar'],shape=[2,1])
call sub (array)
contains
subroutine sub (array)
class(*), intent(in) :: array(:,:)
class(*), allocatable :: copy(:,:)
select type (array)
type is (character(*))
print *, len(array), shape(array), array, ' (expect 3 2 1 foobar)'
end select
allocate(copy, source=array)
select type (copy)
type is (character(*))
print *, len(copy), shape(copy), copy, ' (expect 3 2 1 foobar)'
end select
end
end
I'm getting this output. The result of the copy is corrupt.
3 2 1 foobar (expect 3 2 1 foobar)
3 2 1 foob� (expect 3 2 1 foobar)
More information about the Gcc-bugs
mailing list