http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55855

             Bug #: 55855
           Summary: incorrect warning with type-bound procedure pointer
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: abenso...@gmail.com


The following:

module eventMod
  type, public :: event
     private
    procedure(eventTask ), pointer, public :: task
 end type event
  abstract interface
     logical function eventTask(self)
       import event
       class(event), intent(in) :: self
     end function eventTask
  end interface
end module eventMod
program test
  use eventMod
  implicit none
  logical :: r
  type(event), pointer :: myEvent
  allocate(myEvent)
  r=myEvent%task()
end program test

causes the following warning when compiled (with gfortran 4.8.0):

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/abenson/Galacticus/Tools/libexec/gcc/x86_64-unknown-
linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --
prefix=/home/abenson/Galacticus/Tools --enable-languages=c,c++,fortran --
disable-multilib --with-gmp=/home/abenson/Galacticus/Tools
Thread model: posix
gcc version 4.8.0 20121219 (experimental) (GCC)

$ gfortran -o warn.exe warn.F90 -Wall
warn.F90:19.4:

  r=myEvent%task()
    1
Warning: POINTER valued function appears on right-hand side of assignment at
(1)

As far as I can tell, the code runs correctly despite this warning.

the warning is spurious as the "task" function returns a logical, not a
pointer.

Reply via email to