mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 06:46:36 +00:00

When the shapes of actual arguments to ELEMENTAL procedures are sufficiently well known during semantics, require them to conform. Differential Revision: https://reviews.llvm.org/D109909
19 lines
643 B
Fortran
19 lines
643 B
Fortran
! RUN: %python %S/test_errors.py %s %flang_fc1
|
|
! Enforce array conformance across actual arguments to ELEMENTAL
|
|
module m
|
|
contains
|
|
real elemental function f(a, b)
|
|
real, intent(in) :: a, b
|
|
f = a + b
|
|
end function
|
|
real function g(n)
|
|
integer, value :: n
|
|
g = sqrt(real(n))
|
|
end function
|
|
subroutine test
|
|
real :: a(3) = [1, 2, 3]
|
|
!ERROR: Dimension 1 of actual argument (a) corresponding to dummy argument #1 ('a') has extent 3, but actual argument ([REAL(4)::(g(int(j,kind=4)),INTEGER(8)::j=1_8,2_8,1_8)]) corresponding to dummy argument #2 ('b') has extent 2
|
|
print *, f(a, [(g(j), j=1, 2)])
|
|
end subroutine
|
|
end
|