Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

133 lines
6.0 KiB
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
! Regression test for more than one part-ref with nonzero rank
program m
interface
function real_info1(i)
end
subroutine real_info2()
end
subroutine real_generic()
end
end interface
type mt
complex :: c, c2(2)
integer :: x, x2(2)
character(10) :: s, s2(2)
real, pointer :: p
real, allocatable :: a
contains
procedure, nopass :: info1 => real_info1
procedure, nopass :: info2 => real_info2
procedure, nopass :: real_generic
generic :: g1 => real_generic
end type
type mt2
type(mt) :: t1(2,2)
end type
type mt3
type(mt2) :: t2(2)
end type
type mt4
type(mt3) :: t3(2)
end type
type(mt4) :: t(2)
print *, t(1)%t3(1)%t2(1)%t1%x ! no error
print *, t(1)%t3(1)%t2(1)%t1%x2(1) ! no error
print *, t(1)%t3(1)%t2(1)%t1%s(1:2) ! no error
print *, t(1)%t3(1)%t2(1)%t1%s2(1)(1:2) ! no error
print *, t(1)%t3(1)%t2(1)%t1%c%RE ! no error
print *, t(1)%t3(1)%t2(1)%t1%c%IM ! no error
print *, t(1)%t3(1)%t2(1)%t1%c2(1)%RE ! no error
print *, t(1)%t3(1)%t2(1)%t1%c2(1)%IM ! no error
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
print *, t%t3%t2%t1%x
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
print *, t(1)%t3%t2%t1%x
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
print *, t(1)%t3(1)%t2%t1%x
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
print *, t(1)%t3%t2(1)%t1%x
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
print *, t%t3%t2%t1%x2(1)
!ERROR: Reference to whole rank-1 component 'x2' of rank-2 array of derived type is not allowed
print *, t(1)%t3%t2%t1%x2
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
print *, t(1)%t3(1)%t2%t1%x2(1)
!ERROR: Subscripts of component 'x2' of rank-2 derived type array have rank 1 but must all be scalar
print *, t(1)%t3(1)%t2(1)%t1%x2(1:)
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
print *, t%t3%t2%t1%s(1:2)
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
print *, t(1)%t3%t2(1)%t1%s(1:2)
!ERROR: Subscripts of component 't1' of rank-1 derived type array have rank 1 but must all be scalar
print *, t%t3%t2%t1(1,:)%s(1:2)
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
print *, t%t3%t2%t1%s2(1)(1:2)
!ERROR: Subscripts of component 's2' of rank-2 derived type array have rank 1 but must all be scalar
print *, t(1)%t3%t2%t1%s2(1:)(1:2)
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
print *, t%t3%t2%t1%c%RE
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
print *, t(1)%t3%t2%t1%c%RE
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
print *, t(1)%t3(1)%t2%t1%c%RE
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
print *, t(1)%t3%t2(1)%t1%c%RE
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
print *, t%t3%t2%t1%c%IM
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
print *, t%t3%t2%t1%c2(1)%RE
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
print *, t(1)%t3%t2%t1%c2(1)%RE
!ERROR: Subscripts of component 'c2' of rank-2 derived type array have rank 1 but must all be scalar
print *, t(1)%t3(1)%t2%t1%c2(1:)%RE
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
print *, t(1)%t3%t2(1)%t1%c2(1)%RE
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
print *, t%t3%t2%t1%c2(1)%IM
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
call sub0(t%t3%t2%t1%info1(i))
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
call sub0(t%t3%t2%t1%info1)
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
call t%t3%t2%t1%info2
!ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed
call t%t3%t2%t1%g1
!ERROR: Reference to rank-2 object 't1' has 1 subscripts
call sub0(t%t3%t2%t1(1)%info1(i))
!ERROR: Reference to rank-2 object 't1' has 1 subscripts
call sub0(t%t3%t2%t1(1)%info1)
!ERROR: Reference to rank-2 object 't1' has 1 subscripts
call t%t3%t2%t1(1)%info2
!ERROR: Reference to rank-2 object 't1' has 1 subscripts
call t%t3%t2%t1(1)%g1
!ERROR: Reference to rank-2 object 't1' has 1 subscripts
call sub0(t%t3%t2%t1(1:)%info1(i))
!ERROR: Reference to rank-2 object 't1' has 1 subscripts
call sub0(t%t3%t2%t1(1:)%info1)
!ERROR: Reference to rank-2 object 't1' has 1 subscripts
call t%t3%t2%t1(1:)%info2
!ERROR: Reference to rank-2 object 't1' has 1 subscripts
call t%t3%t2%t1(1:)%g1
!ERROR: An allocatable or pointer component reference must be applied to a scalar base
print *, t(1)%t3(1)%t2(1)%t1%p
!ERROR: An allocatable or pointer component reference must be applied to a scalar base
print *, t%t3(1)%t2(1)%t1(1,1)%p
!ERROR: An allocatable or pointer component reference must be applied to a scalar base
print *, t(1)%t3(1)%t2(1)%t1%a
!ERROR: An allocatable or pointer component reference must be applied to a scalar base
print *, t%t3(1)%t2(1)%t1(1,1)%a
!ERROR: An allocatable or pointer component reference must be applied to a scalar base
t(1)%t3(1)%t2(1)%t1%p => null()
!ERROR: An allocatable or pointer component reference must be applied to a scalar base
t%t3(1)%t2(1)%t1(1,1)%p => null()
end