Andre Kuhlenschmidt 83b462af17
[flang][CLI] Have the CLI hint the flag to disable a warning (#144767)
Adds a hint to the warning message to disable a warning and updates the
tests to expect this.

Also fixes a bug in the storage of canonical spelling of error flags so
that they are not used after free.
2025-06-30 10:17:05 -07:00

26 lines
1.0 KiB
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
! Test the RelaxedIntentInChecking extension
module m
contains
subroutine intentInUnlimited(x)
class(*), dimension(..), pointer, intent(in) :: x
end
subroutine intentInOutUnlimited(x)
class(*), dimension(..), pointer, intent(in out) :: x
end
subroutine test
integer, target :: scalar
real, pointer :: arrayptr(:)
class(*), pointer :: unlimited(:)
call intentInUnlimited(scalar)
!ERROR: Actual argument associated with POINTER dummy argument 'x=' must also be POINTER unless INTENT(IN)
call intentInOutUnlimited(scalar)
!PORTABILITY: If a POINTER or ALLOCATABLE dummy or actual argument is unlimited polymorphic, both should be so [-Wrelaxed-intent-in-checking]
call intentInUnlimited(arrayptr)
!ERROR: If a POINTER or ALLOCATABLE dummy or actual argument is unlimited polymorphic, both must be so
call intentInOutUnlimited(arrayptr)
call intentInUnlimited(unlimited) ! ok
call intentInOutUnlimited(unlimited) ! ok
end
end