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

            Bug ID: 58023
           Summary: ICE on invalid with missing NOPASS
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: abensonca at gmail dot com

The following causes and ICE using gfortran 4.9.0 (r201320):

module m
  implicit none

  abstract interface
     double precision function mr()
     end function mr
  end interface

  type :: sfd
     procedure(mr), pointer :: mr1
     procedure(mr), pointer :: mr2
  end type sfd

contains

  subroutine go()
    implicit none
    type(sfd):: d

    write (0,*) d%mr2()
    return
  end subroutine go

end module m



$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/abenson/Galacticus/Tools/libexec/gcc/x86_64-unknown-linux-gnu/4.9.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.9.0 20130729 (experimental) (GCC) 

$ gfortran -c bug.F90 -o bug.o
bug.F90:10.34:

     procedure(mr), pointer :: mr1
                                  1
Error: Procedure pointer component 'mr1' with PASS at (1) must have at least
one argument
f951: internal compiler error: in update_ppc_arglist, at fortran/resolve.c:5346
0x58332a update_ppc_arglist
        ../../gcc-trunk/gcc/fortran/resolve.c:5346
0x57f63c resolve_expr_ppc
        ../../gcc-trunk/gcc/fortran/resolve.c:6020
0x57f63c gfc_resolve_expr(gfc_expr*)
        ../../gcc-trunk/gcc/fortran/resolve.c:6119
0x5860bb resolve_code
        ../../gcc-trunk/gcc/fortran/resolve.c:9692
0x585e0b gfc_resolve_blocks(gfc_code*, gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/resolve.c:9006
0x586099 resolve_code
        ../../gcc-trunk/gcc/fortran/resolve.c:9682
0x588c8e resolve_codes
        ../../gcc-trunk/gcc/fortran/resolve.c:14471
0x588b97 resolve_codes
        ../../gcc-trunk/gcc/fortran/resolve.c:14457
0x588d72 gfc_resolve
        ../../gcc-trunk/gcc/fortran/resolve.c:14499
0x5755bf gfc_parse_file()
        ../../gcc-trunk/gcc/fortran/parse.c:4645
0x5b1545 gfc_be_parse_file
        ../../gcc-trunk/gcc/fortran/f95-lang.c:189
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

The code is invalid because both procedure pointers in the "sfd" derived type
should have the NOPASS attribute (since the "mr" abstract interface declares no
arguments). 

The ICE only occurs if two (or more) procedure points are declared in this way,
AND the procedure pointer is accessed (via the write statement in this
example).

Reply via email to