Files
clang-p2996/flang/test/Semantics/pure02.f90
Peter Klausler 325d1d0b73 [flang] Fix purity checking for internal subprograms (#91759)
ELEMENTAL internal subprograms are pure unless explicitly IMPURE.
2024-05-15 15:58:20 -07:00

60 lines
1.4 KiB
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
pure subroutine s1
contains
!ERROR: An internal subprogram of a pure subprogram must also be pure
subroutine t1
end
pure subroutine t2 ! ok
end
elemental subroutine t3(k) ! ok
integer, intent(in) :: k
end
!ERROR: An internal subprogram of a pure subprogram must also be pure
impure elemental subroutine t4(k)
integer, intent(in) :: k
end
!ERROR: An internal subprogram of a pure subprogram must also be pure
elemental impure subroutine t5(k)
integer, intent(in) :: k
end
end
elemental subroutine s2(j)
integer, intent(in) :: j
contains
!ERROR: An internal subprogram of a pure subprogram must also be pure
subroutine t1
end
pure subroutine t2 ! ok
end
elemental subroutine t3(k) ! ok
integer, intent(in) :: k
end
!ERROR: An internal subprogram of a pure subprogram must also be pure
impure elemental subroutine t4(k)
integer, intent(in) :: k
end
!ERROR: An internal subprogram of a pure subprogram must also be pure
elemental impure subroutine t5(k)
integer, intent(in) :: k
end
end
impure elemental subroutine s3(j)
integer, intent(in) :: j
contains
subroutine t1
end
pure subroutine t2
end
elemental subroutine t3(k)
integer, intent(in) :: k
end
impure elemental subroutine t4(k)
integer, intent(in) :: k
end
elemental impure subroutine t5(k)
integer, intent(in) :: k
end
end