This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/84504] New: procedure pointer variables cannot be initialized with functions returning pointers


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

            Bug ID: 84504
           Summary: procedure pointer variables cannot be initialized with
                    functions returning pointers
           Product: gcc
           Version: 6.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sriram at pobox dot com
  Target Milestone: ---

Also occurs on gcc 7.2.0 - not tried on other version.

procedure pointer variables pointing initialized with functions returning
pointers fail to compile.  Note that the sample code below compiles if we
change the function type to not be a pointer.


Source:
module test_procedure_pointer
  implicit none
  private
  procedure(the_proc), pointer  :: ptr => the_proc
contains
  function the_proc() 
    integer, pointer :: the_proc
  end function the_proc
end module test_procedure_pointer

Error:
   procedure(the_proc), pointer  :: ptr => the_proc
                                                  1
Error: Pointer initialization target at (1) must have the TARGET attribute


save-temps:
sn-fey1[1-290] gfortran -v -save-temps ~/procpointer.f90
Driving: gfortran -v -save-temps /users/sriram/procpointer.f90 -l gfortran -l m
-shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/yellow/usr/projects/hpcsoft/toss3/common/gcc/6.4.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.4.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-6.4.0/configure
--prefix=/usr/projects/hpcsoft/toss3/common/gcc/6.4.0 --enable-threads=posix
--enable-__cxa_atexit --enable-lto --enable-checking=release --disable-multilib
--enable-languages=c,c++,fortran
Thread model: posix
gcc version 6.4.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'

/yellow/usr/projects/hpcsoft/toss3/common/gcc/6.4.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.4.0/f951
/users/sriram/procpointer.f90 -quiet -dumpbase procpointer.f90 -mtune=generic
-march=x86-64 -auxbase procpointer -version -fintrinsic-modules-path
/yellow/usr/projects/hpcsoft/toss3/common/gcc/6.4.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.4.0/finclude
-o procpointer.s
GNU Fortran (GCC) version 6.4.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 6.4.0, GMP version 4.3.2, MPFR version 2.4.2,
MPC version 0.8.1, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran2008 (GCC) version 6.4.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 6.4.0, GMP version 4.3.2, MPFR version 2.4.2,
MPC version 0.8.1, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
/users/sriram/procpointer.f90:4:50:

   procedure(the_proc), pointer  :: ptr => the_proc
                                                  1
Error: Pointer initialization target at (1) must have the TARGET attribute

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]