[Bug fortran/77412] constructor of an extended type with an allocatable component in the base type crashes gfortran
gscfq@t-online.de
gcc-bugzilla@gcc.gnu.org
Thu Nov 15 18:05:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77412
G. Steinmetz <gscfq@t-online.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gscfq@t-online.de
--- Comment #3 from G. Steinmetz <gscfq@t-online.de> ---
Update :
$ cat z1.f90
program p
type t
real, allocatable :: a
end type
type, extends(t) :: t2
end type
type(t2) :: z
z = t2(1.0)
end
$ gfortran-9-20181111 -c z1.f90
z1.f90:8:0:
8 | z = t2(1.0)
|
internal compiler error: in fold_convert_loc, at fold-const.c:2426
0x8a9b87 fold_convert_loc(unsigned int, tree_node*, tree_node*)
../../gcc/fold-const.c:2425
0x6ed255 gfc_trans_scalar_assign(gfc_se*, gfc_se*, gfc_typespec, bool, bool,
bool)
../../gcc/fortran/trans-expr.c:9063
0x6f3a19 gfc_trans_subcomponent_assign
../../gcc/fortran/trans-expr.c:7707
0x6f3fba gfc_trans_structure_assign(tree_node*, gfc_expr*, bool, bool)
../../gcc/fortran/trans-expr.c:7824
0x6f3ae2 gfc_trans_subcomponent_assign
../../gcc/fortran/trans-expr.c:7659
0x6f3fba gfc_trans_structure_assign(tree_node*, gfc_expr*, bool, bool)
../../gcc/fortran/trans-expr.c:7824
0x6ee76f gfc_conv_structure(gfc_se*, gfc_expr*, int)
../../gcc/fortran/trans-expr.c:7891
0x6ee9ac gfc_conv_expr(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-expr.c:8059
0x6fcfd9 gfc_trans_assignment_1
../../gcc/fortran/trans-expr.c:10248
0x6bfdaf trans_code
../../gcc/fortran/trans.c:1822
0x6e7674 gfc_generate_function_code(gfc_namespace*)
../../gcc/fortran/trans-decl.c:6509
0x6744d6 translate_all_program_units
../../gcc/fortran/parse.c:6125
0x6744d6 gfc_parse_file()
../../gcc/fortran/parse.c:6328
0x6bc89f gfc_be_parse_file
../../gcc/fortran/f95-lang.c:204
---
$ cat z3.f90
program p
type t
integer, allocatable :: a
end type
type, extends(t) :: t2
end type
type(t2) :: z
z = t2(1)
print *, z%a
end
$ gfortran-9-20181111 z3.f90 -g -O0 -static-libgfortran
$ a.out
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
#0 0x7efd5afcb15f in ???
#1 0x40c379 in extract_int
at ../../../libgfortran/io/write.c:579
#2 0x40f872 in write_decimal
at ../../../libgfortran/io/write.c:810
#3 0x40fc04 in write_integer
at ../../../libgfortran/io/write.c:1352
#4 0x410a1d in list_formatted_write_scalar
at ../../../libgfortran/io/write.c:1866
#5 0x404515 in wrap_scalar_transfer
at ../../../libgfortran/io/transfer.c:2369
#6 0x404515 in wrap_scalar_transfer
at ../../../libgfortran/io/transfer.c:2346
#7 0x402445 in p
at z3.f90:9
#8 0x40248b in main
at z3.f90:10
Segmentation fault (core dumped)
More information about the Gcc-bugs
mailing list