Bug 82970 - ICE in vptr_field_get, at fortran/trans-expr.c:264
Summary: ICE in vptr_field_get, at fortran/trans-expr.c:264
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-13 17:32 UTC by G. Steinmetz
Modified: 2022-10-04 05:15 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-08-02 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description G. Steinmetz 2017-11-13 17:32:10 UTC
Wrapping source "x" :


$ cat z1.f90
program p
   type t
   end type
   class(t), allocatable :: x(:)[:]
   class(t), allocatable :: z(:)
   allocate (x(2)[*])
   allocate (z, source=(x))
end


$ cat z2.f90
program p
   type t
   end type
   class(t), allocatable :: x(:)[:]
   class(t), allocatable :: z(:)
   allocate (x(2)[*])
   allocate (z, mold=(x))
end


$ gfortran-8-20171112 -c z1.f90 -fcoarray=single
z1.f90:7:0:

    allocate (z, source=(x))

internal compiler error: Segmentation fault
0xb61c7f crash_signal
        ../../gcc/toplev.c:325
0x75b91f vptr_field_get
        ../../gcc/fortran/trans-expr.c:264
0x75c71d gfc_vptr_size_get(tree_node*)
        ../../gcc/fortran/trans-expr.c:325
0x79f9fb gfc_trans_allocate(gfc_code*)
        ../../gcc/fortran/trans-stmt.c:5842
0x731ce7 trans_code
        ../../gcc/fortran/trans.c:1980
0x75897c gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.c:6421
0x6ea920 translate_all_program_units
        ../../gcc/fortran/parse.c:6091
0x6ea920 gfc_parse_file()
        ../../gcc/fortran/parse.c:6294
0x72f13f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:204
Comment 1 G. Steinmetz 2017-11-13 17:32:33 UTC
This variant compiles, of course :


$ cat z3.f90
program p
   type t
   end type
   class(t), allocatable :: x(:)[:]
   class(t), allocatable :: z(:)
   allocate (x(2)[*])
   allocate (z, source=x)
end
Comment 2 Dominique d'Humieres 2017-11-13 20:35:52 UTC
Confirmed from 6.4.0 up to trunk (8.0).

If I replace

   allocate (z, source=(x))

with

    allocate (z(2), source=(x))

compiling the test gives an ICE also for 4.8, 4.9, and 5.
Comment 3 Andrew Pinski 2021-08-02 15:02:32 UTC
I need the following on the trunk:

Error: non-trivial conversion in 'var_decl'
struct array02_t
struct array01_character(kind=1)
ctmp.3._data = atmp.2;
/app/example.f90:2:9: internal compiler error: 'verify_gimple' failed