summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/warn_implicit_procedure_1.f90
blob: 8f21b60e9c2dbef5e4e573772997695cbabdf649 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
! { dg-do compile }
! { dg-options "-Wimplicit-procedure" }

! PR fortran/22552
! Check for correct -Wimplicit-procedure warnings.

MODULE m

CONTAINS

  SUBROUTINE my_sub ()
  END SUBROUTINE my_sub

  INTEGER FUNCTION my_func ()
    my_func = 42
  END FUNCTION my_func

END MODULE m

SUBROUTINE test (proc)
  IMPLICIT NONE
  CALL proc () ! { dg-bogus "is not explicitly declared" }
END SUBROUTINE test

PROGRAM main
  USE m
  EXTERNAL :: ext_sub
  EXTERNAL :: test
  INTEGER :: ext_func

  CALL ext_sub () ! { dg-bogus "is not explicitly declared" }
  PRINT *, ext_func () ! { dg-bogus "is not explicitly declared" }
  PRINT *, implicit_func () ! { dg-bogus "is not explicitly declared" }
  CALL my_sub () ! { dg-bogus "is not explicitly declared" }
  PRINT *, my_func () ! { dg-bogus "is not explicitly declared" }
  PRINT *, SIN (3.14159) ! { dg-bogus "is not explicitly declared" }

  CALL undef_sub (1, 2, 3) ! { dg-warning "is not explicitly declared" }
  ! Can't check undefined function, because it needs to be declared a type
  ! in any case (and the implicit type is enough to not trigger this warning).
END PROGRAM

! { dg-final { cleanup-modules "m" } }