Merge from trunk @ 138209
[official-gcc.git] / gcc / testsuite / gfortran.dg / intrinsic_shadow_1.f03
blob776d0f692d9e5577fa4d7295791169017ff7ceeb
1 ! { dg-do compile }
2 ! { dg-options "-std=f2003 -Wintrinsic-shadow" }
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=*.
8 MODULE testmod
9   IMPLICIT NONE
11 CONTAINS
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
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
25 END MODULE testmod
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
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
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
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
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
55 ! We do only compile, so no main program needed.
57 ! { dg-final { cleanup-modules "testmod" } }