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

            Bug ID: 98472
           Summary: internal compiler error: in gfc_conv_expr_descriptor,
                    at fortran/trans-array.c:7352
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ruicoelhopedro at hotmail dot com
  Target Milestone: ---

This occurs during an allocation whose source is the result of an elemental
function in a polymorphic class.
Tested in versions 7.5.0, 9.2.1 and 10.2.0, report below is shown for version
10.2.0




$ cat mwe.f90
module a
        type, abstract :: base
        contains
                procedure(elem_func), deferred, nopass :: add
        end type base

        type, extends(base) :: derived
        contains
                procedure, nopass :: add => add_derived
        end type derived

        abstract interface
                elemental function elem_func(x, y) result(out)
                        integer, intent(in) :: x, y
                        integer :: out
                end function elem_func
        end interface

contains
        elemental function add_derived(x, y) result(out)
                integer, intent(in) :: x, y
                integer :: out
                out = x + y
        end function add_derived
end module a

program main
        use a
        integer, dimension(:), allocatable :: vec
        class(base), allocatable :: instance
        allocate(derived :: instance)
        allocate(vec, source=instance%add([1, 2], [1, 2]))
end program main




$ gfortran mwe.f90
mwe.f90:32:0:

   32 |         allocate(vec, source=instance%add([1, 2], [1, 2]))
      | 
internal compiler error: in gfc_conv_expr_descriptor, at
fortran/trans-array.c:7352
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.




$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --with-isl
--with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit
--enable-cet=auto --enable-checking=release --enable-clocale=gnu
--enable-default-pie --enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id
--enable-lto --enable-multilib --enable-plugin --enable-shared
--enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-libunwind-exceptions --disable-werror
gdc_include_dir=/usr/include/dlang/gdc
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.0 (GCC)

Reply via email to