https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123782
Bug ID: 123782
Summary: False error in pointer to contiguous component
selection
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: ivan.pribec at gmail dot com
Target Milestone: ---
gfortran 15.2 reports an error when pointing to what I assume is a contiguous
target:
type :: t1
real :: x
end type
type :: t2
real :: x, y
end type
type(t1), target :: a(5) ! supposed to be contiguous
type(t2), target :: b(5)
real, pointer, contiguous :: c(:)
a%x = 1.0
b%x = 2.0
b%y = 3.0
c => a%x ! False error?
!c => b%x ! Error: assignment to contiguous pointer from non-contiguous
target
end
I suppose a compiler could insert padding into a derived type with a single
member, so I'm not completely sure if this is a correct or not. The same error
occurs if I add sequence attribute in t1.