https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114023

--- Comment #7 from anlauf at gcc dot gnu.org ---
The problem is even more fundamental and occurs with derived types, too:

program test
  implicit none
  type cx
     real :: re, im
  end type cx
  real, pointer       :: rr1(:), rr2(:), rr3(:), rr4(:)
  type(cx), parameter :: cvals(*) = [cx(1,-1),cx(2,-2),cx(3,-3)]
  type(cx)             , target :: ref(size(cvals)) = cvals
  type(cx), allocatable, target :: arr(:)

  arr = cvals

  rr1(1:3) => ref%re
  print *, "rr1:", rr1
  rr2      => ref%re
  print *, "rr2:", rr2
  rr3(1:3) => arr%re
  print *, "rr3:", rr3
  rr4      => arr%re
  print *, "rr4:", rr4
  print *, is_contiguous(rr1), is_contiguous(rr2), &
       is_contiguous(rr3), is_contiguous(rr4)
end program test

15-branch prints:

 rr1:   1.00000000       2.00000000       3.00000000    
 rr2:   1.00000000       2.00000000       3.00000000    
 rr3:   1.00000000       2.00000000       3.00000000    
 rr4:   1.00000000       2.00000000       3.00000000    
 T T T T

16-trunk + attached patch:

 rr1:   1.00000000       2.00000000       3.00000000    
 rr2:   1.00000000       2.00000000       3.00000000    
 rr3:   1.00000000       2.00000000       3.00000000    
 rr4:   1.00000000       2.00000000       3.00000000    
 F F F T

Reply via email to