| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-std=f2003 -Wintrinsic-shadow" } |
| 3 |
|
| 4 |
! PR fortran/33141 |
| 5 |
! Check that the expected warnings are emitted if a user-procedure has the same |
| 6 |
! name as an intrinsic, but only if it is matched by the current -std=*. |
| 7 |
|
| 8 |
MODULE testmod |
| 9 |
IMPLICIT NONE |
| 10 |
|
| 11 |
CONTAINS |
| 12 |
|
| 13 |
! ASIN is an intrinsic |
| 14 |
REAL FUNCTION asin (arg) ! { dg-warning "shadow the intrinsic" } |
| 15 |
IMPLICIT NONE |
| 16 |
REAL :: arg |
| 17 |
END FUNCTION asin |
| 18 |
|
| 19 |
! ASINH is one but not in F2003 |
| 20 |
REAL FUNCTION asinh (arg) ! { dg-bogus "shadow the intrinsic" } |
| 21 |
IMPLICIT NONE |
| 22 |
REAL :: arg |
| 23 |
END FUNCTION asinh |
| 24 |
|
| 25 |
END MODULE testmod |
| 26 |
|
| 27 |
! ACOS is an intrinsic |
| 28 |
REAL FUNCTION acos (arg) ! { dg-warning "of an intrinsic" } |
| 29 |
IMPLICIT NONE |
| 30 |
REAL :: arg |
| 31 |
END FUNCTION acos |
| 32 |
|
| 33 |
! ACOSH not for F2003 |
| 34 |
REAL FUNCTION acosh (arg) ! { dg-bogus "of an intrinsic" } |
| 35 |
IMPLICIT NONE |
| 36 |
REAL :: arg |
| 37 |
END FUNCTION acosh |
| 38 |
|
| 39 |
! A subroutine with the same name as an intrinsic subroutine |
| 40 |
SUBROUTINE random_number (arg) ! { dg-warning "of an intrinsic" } |
| 41 |
IMPLICIT NONE |
| 42 |
REAL, INTENT(OUT) :: arg |
| 43 |
END SUBROUTINE random_number |
| 44 |
|
| 45 |
! But a subroutine with the name of an intrinsic function is ok. |
| 46 |
SUBROUTINE atan (arg) ! { dg-bogus "of an intrinsic" } |
| 47 |
IMPLICIT NONE |
| 48 |
REAL :: arg |
| 49 |
END SUBROUTINE atan |
| 50 |
|
| 51 |
! As should be a function with the name of an intrinsic subroutine. |
| 52 |
REAL FUNCTION random_seed () ! { dg-bogus "of an intrinsic" } |
| 53 |
END FUNCTION random_seed |
| 54 |
|
| 55 |
! We do only compile, so no main program needed. |