2 Bug fixes: - Do not resolve procedure as intrinsic if they appeared in an EXTERNAL attribute statement (one path was not considering this flag) - Emit an error if a procedure resolved to be an intrinsic function (resp. subroutine) is used as a subroutine (resp. function). Lowering was attempted while the evaluate::Expression for the call was missing without any errors. 1 behavior change: - Do not implicitly resolve subroutines (resp. functions) as intrinsics because their name is the name of an intrinsic function (resp. subroutine). Add justification in documentation. Reviewed By: klausler, tskeith Differential Revision: https://reviews.llvm.org/D90049
14 lines
341 B
Fortran
14 lines
341 B
Fortran
! RUN: %S/test_errors.sh %s %t %f18
|
|
|
|
! Test that intrinsic functions used as subroutines and vice versa are caught.
|
|
|
|
subroutine test(x, t)
|
|
intrinsic :: sin, cpu_time
|
|
!ERROR: Cannot use intrinsic function 'sin' as a subroutine
|
|
call sin(x)
|
|
!ERROR: Cannot use intrinsic subroutine 'cpu_time' as a function
|
|
x = cpu_time(t)
|
|
end subroutine
|
|
|
|
|