[Bug fortran/84546] New: [7/8 Regression] Bad sourced allocation of CLASS(*) with source with CLASS(*) component
neil.n.carlson at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Feb 25 00:13:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84546
Bug ID: 84546
Summary: [7/8 Regression] Bad sourced allocation of CLASS(*)
with source with CLASS(*) component
Product: gcc
Version: 8.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: neil.n.carlson at gmail dot com
Target Milestone: ---
The following example produces the expected result with 6.4.1, but not with the
latest 7 and 8 trunk. The correct output is "foobar", but 7/8 produce "foob"
module any_vector_type
type :: any_vector
class(*), allocatable :: vec(:)
end type
interface any_vector
procedure any_vector1
end interface
contains
function any_vector1(vec) result(this)
class(*), intent(in) :: vec(:)
type(any_vector) :: this
allocate(this%vec, source=vec)
end function
end module
program main
use any_vector_type
implicit none
class(*), allocatable :: x
character(*), parameter :: vec(*) = ['foo','bar']
allocate(x, source=any_vector(vec))
select type (x)
type is (any_vector)
select type (xvec => x%vec)
type is (character(*))
print *, xvec ! EXPECT "foobar"
if (any(xvec /= vec)) stop 1
end select
end select
end program
More information about the Gcc-bugs
mailing list