[Bug fortran/69739] New: ICE during array result, allocatable assignment

jwmwalrus at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Feb 10 01:33:00 GMT 2016


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

            Bug ID: 69739
           Summary: ICE during array result, allocatable assignment
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jwmwalrus at gmail dot com
  Target Milestone: ---

Hi.

With the code below I get an ICE with both GFortran 5 and 6.

!-----
module test
    implicit none
    private
    save

    type, public :: sometype
        real :: a    =  0.
    end type
contains
    function dosomething(A) &
        result(res)
        real :: res
        type(sometype), intent(IN) :: A(:,:,:)
        integer :: N
        real, allocatable ::   R(:), X(:)

        N = PRODUCT(UBOUND(A))
        allocate (R(N), X(N))
        X = 0
        R = operate(A, X)
!        R(:) = operate(A, X)
        res = HUGE(1.)
    end function

    function operate(A, X)
        type(sometype), intent(IN) :: A(:,:,:)
        real, intent(IN) :: X(:)
        real :: operate(1:PRODUCT(UBOUND(A)))

        operate = 0
    end function
end module test
!-----

Adding (:) to the array (as shown in the commented line) makes the ICE go away,
so it seems there's an issue with assignment to an allocatable variable.



The output was:

~$ gfortran-5 -c  test.f90 
test.f90:20:0:

         R = operate(A, X)
 1
internal compiler error: in gfc_map_intrinsic_function, at
fortran/trans-expr.c:3926
0x659661 gfc_map_intrinsic_function
        ../../src/gcc/fortran/trans-expr.c:3926
0x659661 gfc_apply_interface_mapping_to_expr
        ../../src/gcc/fortran/trans-expr.c:4056
0x65945a gfc_apply_interface_mapping_to_expr
        ../../src/gcc/fortran/trans-expr.c:4051
0x65763c gfc_apply_interface_mapping(gfc_interface_mapping*, gfc_se*,
gfc_expr*)
        ../../src/gcc/fortran/trans-expr.c:4091
0x63c202 gfc_set_loop_bounds_from_array_spec(gfc_interface_mapping*, gfc_se*,
gfc_array_spec*)
        ../../src/gcc/fortran/trans-array.c:794
0x651dd5 gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*,
gfc_expr*, vec<tree_node*, va_gc, vl_embed>*)
        ../../src/gcc/fortran/trans-expr.c:5624
0x64c32d gfc_trans_arrayfunc_assign
        ../../src/gcc/fortran/trans-expr.c:8433
0x64bb34 gfc_trans_assignment(gfc_expr*, gfc_expr*, bool, bool)
        ../../src/gcc/fortran/trans-expr.c:9244
0xd4c910 trans_code
        ../../src/gcc/fortran/trans.c:1701
0xd4c910 gfc_trans_code(gfc_code*)
        ../../src/gcc/fortran/trans.c:2005
0xd51328 gfc_generate_function_code(gfc_namespace*)
        ../../src/gcc/fortran/trans-decl.c:5851
0x62db67 gfc_generate_module_code(gfc_namespace*)
        ../../src/gcc/fortran/trans.c:2072
0xd2f0ca translate_all_program_units
        ../../src/gcc/fortran/parse.c:5330
0xd2f0ca gfc_parse_file()
        ../../src/gcc/fortran/parse.c:5540
0x1200555 gfc_be_parse_file
        ../../src/gcc/fortran/f95-lang.c:229
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.



~$ gfortran-6 -c  test.f90 
test.f90:20:0:

         R = operate(A, X)


internal compiler error: in gfc_map_intrinsic_function, at
fortran/trans-expr.c:4089
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions.



The OS and compiler versions are:

$ lsb_release -rd && gfortran-5 -v && gfortran-6 -v
Description:    Debian GNU/Linux testing-updates (sid)
Release:        testing-updates
Using built-in specs.
COLLECT_GCC=gfortran-5
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 5.3.1-7'
--with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-5 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 5.3.1 20160121 (Debian 5.3.1-7) 
Using built-in specs.
COLLECT_GCC=gfortran-6
COLLECT_LTO_WRAPPER=/usr/lib/gcc-snapshot/libexec/gcc/x86_64-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 20160125-1'
--with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs
--enable-languages=c,ada,c++,java,go,fortran,objc,obj-c++
--prefix=/usr/lib/gcc-snapshot --enable-shared --enable-linker-build-id
--disable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --disable-vtable-verify --enable-libmpx
--enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-snap-amd64/jre
--enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-snap-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-snap-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--disable-werror --enable-checking=yes --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 6.0.0 20160125 (experimental) [trunk revision 232803] (Debian
20160125-1)


More information about the Gcc-bugs mailing list