[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-fortran
Subject:    ICE assigning to assumed rank derived type component
From:       Andrew Benson <abenson () carnegiescience ! edu>
Date:       2019-11-27 22:33:55
Message-ID: 2400717.EDg1cLL47y () andrew-precision-3520
[Download RAW message or body]

I submitted this to bugzilla as PR 92701:

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

-Andrew

--

The following code causes an ICE with gfortran 10.0 (r278783):

module a

  type :: r
  end type r

  type, extends(r) :: rr
     double precision:: d
  end type rr     
  
contains

  subroutine abd(p)
    implicit none
    class(r), intent(inout), dimension(..) :: p
    double precision, dimension(:), allocatable :: d
    select rank (p)
    rank (1)
       select type (p)
       type is (rr)
          allocate(d(size(p,dim=1)))
          d=0.0d0
          p%d=d
       end select
    end select
    return
  end subroutine abd
  
end module a

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/abenson/Galacticus/Tools/libexec/gcc/x86_64-pc-
linux-gnu/10.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/home/abenson/Galacticus/Tools 
--enable-languages=c,c++,fortran --disable-multilib : (reconfigured) ../gcc-
trunk/configure --prefix=/home/abenson/Galacticus/Tools --disable-multilib --
enable-languages=c,c++,fortran,lto --no-create --no-recursion
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.0.0 20191127 (experimental) (GCC) 


$ gfortran -c bug.F90 -o bug.o
f951: internal compiler error: Segmentation fault
0xdd4adf crash_signal
        ../../gcc-trunk/gcc/toplev.c:328
0x7fa79dd101ef ???
        /data001/abenson/Galacticus/Tools/glibc-2.12.1/signal/../sysdeps/unix/
sysv/linux/x86_64/sigaction.c:0
0x7d41a1 gfc_check_vardef_context(gfc_expr*, bool, bool, bool, char const*)
        ../../gcc-trunk/gcc/fortran/expr.c:6237
0x84cff7 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/resolve.c:11768
0x8508b7 resolve_codes
        ../../gcc-trunk/gcc/fortran/resolve.c:17180
0x83c2ce gfc_resolve(gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/resolve.c:17215
0x83c2ce gfc_resolve(gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/resolve.c:17194
0x84cc58 resolve_block_construct
        ../../gcc-trunk/gcc/fortran/resolve.c:10549
0x84cc58 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/resolve.c:11899
0x84ef43 gfc_resolve_blocks(gfc_code*, gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/resolve.c:10691
0x84fa0b resolve_select_type
        ../../gcc-trunk/gcc/fortran/resolve.c:9544
0x84cbe1 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/resolve.c:11891
0x84ef43 gfc_resolve_blocks(gfc_code*, gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/resolve.c:10691
0x84c3b8 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/resolve.c:11654
0x8508b7 resolve_codes
        ../../gcc-trunk/gcc/fortran/resolve.c:17180
0x8507ee resolve_codes
        ../../gcc-trunk/gcc/fortran/resolve.c:17163
0x83c2ce gfc_resolve(gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/resolve.c:17215
0x83c2ce gfc_resolve(gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/resolve.c:17194
0x82f078 gfc_parse_file()
        ../../gcc-trunk/gcc/fortran/parse.c:6443
0x87f30f gfc_be_parse_file
        ../../gcc-trunk/gcc/fortran/f95-lang.c:210
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.



The ICE seems to be triggered by the "p%d=d" assignment.
-- 

* Andrew Benson: http://users.obs.carnegiescience.edu/abenson/contact.html

* Galacticus: https://github.com/galacticusorg/galacticus

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic