https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67982

            Bug ID: 67982
           Summary: Incorrect -Wunused-function warning
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Joost.VandeVondele at mat dot ethz.ch
  Target Milestone: ---

The following code illustrates an incorrect -Wunused-function warning:

> cat test.f90
MODULE base
  INTERFACE 
    SUBROUTINE bar_int()
    END SUBROUTINE 
  END INTERFACE
  PUBLIC hook
  PRIVATE 
  PROCEDURE(bar_int), POINTER :: hook=>NULL()
END MODULE base

MODULE foo
  USE base, ONLY: hook  
  PUBLIC init
  PRIVATE 
CONTAINS
  SUBROUTINE init()
     hook=>bar
  END SUBROUTINE init
  SUBROUTINE bar()
     WRITE(6,*) "In bar"
  END SUBROUTINE 
END MODULE

USE foo, ONLY: init
USE base, ONLY: hook
CALL init()
CALL hook()
END

> gfortran -Wunused-function test.f90
test.f90:19:0:

   SUBROUTINE bar()
 ^
Warning: ‘bar’ defined but not used [-Wunused-function]

> ./a.out
 In bar

Reply via email to