https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86117
--- Comment #3 from janus at gcc dot gnu.org ---
Here is a variation of the original example that actually runs the routine:
module m
type :: generic
class(*), allocatable :: item
end type
contains
subroutine sub(a, b)
type(generic), dimension(:), intent(in) :: a
type(generic), dimension(:), intent(out) :: b
integer :: i
do i = 1, 10
allocate(b(i)%item, source=a(i)%item)
end do
end
end
program p
use m
type(generic) :: x(10), y(10)
integer ::i
do i=1,10
allocate(x(i)%item, source=i)
end do
call sub(x,y)
end
This runs ok without -fcheck=bounds, but segfaults at runtime with this flag
(in the allocate line in sub).
So I think the warning is probably not bogus, but instead -fcheck=bounds
generates wrong code for this case?