public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/94471] New: Calling a function pointer member of a polymorphic derived type returning a pointer produces an ICE (internal compiler error).
@ 2020-04-03 14:12 lockywolf at gmail dot com
  2020-04-03 14:45 ` [Bug fortran/94471] " marxin at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: lockywolf at gmail dot com @ 2020-04-03 14:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94471
           Summary: Calling a function pointer member of a polymorphic
                    derived type returning a pointer produces an ICE
                    (internal compiler error).
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lockywolf at gmail dot com
  Target Milestone: ---

This is the code:

program main

  type, abstract :: scheme_object
  end type scheme_object
  type, extends(scheme_object) :: scheme_primitive_procedure
     procedure(packageable_procedure), pointer, nopass :: proc_pointer
  end type scheme_primitive_procedure

  class(scheme_object), pointer :: exp

  abstract interface
     function packageable_procedure( argl, env ) result( retval )
       import :: scheme_object
       class(scheme_object), pointer :: retval
       class(scheme_object), pointer :: argl
       class(scheme_object), pointer :: env
     end function packageable_procedure

  end interface


contains
  function low_level_read( arg ) result( retval )
    class(scheme_object), pointer :: retval
    class(scheme_object), pointer :: arg

  end function low_level_read

  subroutine main_loop()
    procedure(packageable_procedure), pointer :: proc
    class(scheme_object), pointer :: retval
    exp => low_level_read( exp )
    call ll_setup_global_environment()
    select type( proc_holder => low_level_read(exp) )
    type is (scheme_primitive_procedure)
       proc => proc_holder%proc_pointer
       retval => proc( exp, exp )
    class default
       error stop "primitive procedure not a procedure"
    end select

  end subroutine main_loop
end program

produces:

gfortran --save-temps -v -Wall -Wextra 2020-04-03-weird-gfortran-bug-2.f90
Driving: gfortran --save-temps -v -Wall -Wextra
2020-04-03-weird-gfortran-bug-2.f90 -l gfortran -l m -shared-libgcc
Reading specs from /usr/lib64/gcc/x86_64-slackware-linux/9.3.0/specs
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-slackware-linux/9.3.0/lto-wrapper
Target: x86_64-slackware-linux
Configured with: ../gcc-9.3.0/configure --prefix=/usr --libdir=/usr/lib64
--mandir=/usr/man --infodir=/usr/info --enable-shared --enable-bootstrap
--enable-languages=ada,brig,c,c++,d,fortran,go,lto,objc,obj-c++
--enable-threads=posix --enable-checking=release --enable-objc-gc
--with-system-zlib --enable-libstdcxx-dual-abi --with-default-libstdcxx-abi=new
--disable-libstdcxx-pch --disable-libunwind-exceptions --enable-__cxa_atexit
--disable-libssp --enable-gnu-unique-object --enable-plugin --enable-lto
--disable-install-libiberty --enable-gnu-indirect-function
--with-linker-hash-style=gnu --with-gnu-ld --with-isl --verbose
--with-arch-directory=amd64 --disable-gtktest --disable-werror
--enable-clocale=gnu --enable-multilib --target=x86_64-slackware-linux
--build=x86_64-slackware-linux --host=x86_64-slackware-linux
Thread model: posix
gcc version 9.3.0 (GCC) 
COLLECT_GCC_OPTIONS='-save-temps' '-v' '-Wall' '-Wextra' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-slackware-linux/9.3.0/f951
2020-04-03-weird-gfortran-bug-2.f90 -quiet -dumpbase
2020-04-03-weird-gfortran-bug-2.f90 -mtune=generic -march=x86-64 -auxbase
2020-04-03-weird-gfortran-bug-2 -Wall -Wextra -version -fintrinsic-modules-path
/usr/lib64/gcc/x86_64-slackware-linux/9.3.0/finclude
-fpre-include=/usr/include/finclude/math-vector-fortran.h -o
2020-04-03-weird-gfortran-bug-2.s
GNU Fortran (GCC) version 9.3.0 (x86_64-slackware-linux)
        compiled by GNU C version 9.3.0, GMP version 6.2.0, MPFR version 4.0.2,
MPC version 1.1.0, isl version isl-0.22.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran2008 (GCC) version 9.3.0 (x86_64-slackware-linux)
        compiled by GNU C version 9.3.0, GMP version 6.2.0, MPFR version 4.0.2,
MPC version 1.1.0, isl version isl-0.22.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
2020-04-03-weird-gfortran-bug-2.f90:37:0:

   37 |        proc => proc_holder%proc_pointer
      | 
internal compiler error: in gfc_conv_component_ref, at
fortran/trans-expr.c:2445
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.

The .i file has not been generated.
The .s file only contains a single line:
        .file   "2020-04-03-weird-gfortran-bug-2.f90"

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug fortran/94471] Calling a function pointer member of a polymorphic derived type returning a pointer produces an ICE (internal compiler error).
  2020-04-03 14:12 [Bug fortran/94471] New: Calling a function pointer member of a polymorphic derived type returning a pointer produces an ICE (internal compiler error) lockywolf at gmail dot com
@ 2020-04-03 14:45 ` marxin at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-03 14:45 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-04-03
             Status|UNCONFIRMED                 |NEW
                 CC|                            |janus at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r7-4526-gd809e15a19e63493 before that the code was
rejected:

     procedure(packageable_procedure), pointer :: proc
                                                     1
Error: CLASS variable ‘proc’ at (1) must be dummy, allocatable or pointer

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-03 14:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-03 14:12 [Bug fortran/94471] New: Calling a function pointer member of a polymorphic derived type returning a pointer produces an ICE (internal compiler error) lockywolf at gmail dot com
2020-04-03 14:45 ` [Bug fortran/94471] " marxin at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).