https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123782
--- Comment #8 from Steve Kargl <kargl at gcc dot gnu.org> ---
(In reply to Ivan Pribec from comment #7)
> $ flang -pedantic foo.f90
> ./foo.f90:16:4: warning: Target of CONTIGUOUS pointer association is not
> known to be contiguous [-Wpointer-to-possible-noncontiguous]
> c => a%x ! False error?
> ^^^^^^^^
> ./foo.f90:12:33: Declaration of 'c'
> real, pointer, contiguous :: c(:)
Thanks for the pointer. I'm not familiar with all of flang's options.
Seems a bit dangerous to only flang this with a warning.
program foo
implicit none
type t1
real :: x
integer :: i
end type
type(t1), target :: a(5) ! supposed to be contiguous
real b(5)
real, pointer, contiguous :: c(:)
a = [t1(1.,42), t1(2.,43), t1(3.,44), t1(4.,45), t1(5.,46)]
c => a%x ! False error?
print *, c
b = [100., 200., 300., 400., 500.]
c = b
print *, a%x
end program foo
% flang21 -o z uo.f90 && ./z
1. 2. 3. 4. 5.
100. 300. 500. 4. 5.
Seems a bit dangerous.