Peter Klausler 9191738764
[flang] Accept CONTIGUOUS attribute when redundant (#70853)
As an extension, accept the redundant use of the CONTIGUOUS attribute
when applied to scalars and to simply contiguous objects, with a
portability warning.
2023-10-31 16:04:35 -07:00

22 lines
1.1 KiB
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
! Testing for pointer constant, along with :
! C751 A component shall not have both the ALLOCATABLE and POINTER attributes.
! C752 If the CONTIGUOUS attribute is specified, the component shall be an
! array with the POINTER attribute.
! C753 The * char-length option is permitted only if the component is of type
! character.
subroutine s()
!ERROR: 'nullint' may not have both the POINTER and PARAMETER attributes
integer, pointer, parameter :: nullint => null()
type derivedType
!ERROR: 'pointerallocatablefield' may not have both the POINTER and ALLOCATABLE attributes
real, pointer, allocatable :: pointerAllocatableField
real, dimension(:), contiguous, pointer :: goodContigField
!PORTABILITY: CONTIGUOUS component 'badcontigfield' should be an array with the POINTER attribute
real, dimension(:), contiguous, allocatable :: badContigField
character :: charField * 3
!ERROR: A length specifier cannot be used to declare the non-character entity 'realfield'
real :: realField * 3
end type derivedType
end subroutine s