https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97652
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|ipa |fortran
--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
push_8 argument type is
arguments <parm_decl 0x7ffff69cd600 self
type <reference_type 0x7ffff69ec000 type <pointer_type 0x7ffff69e3000>
unsigned DI size <integer_cst 0x7ffff680cbb8 64> unit-size
<integer_cst 0x7ffff680cbd0 8>
align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff69ec000>
readonly used unsigned DI passed-by-reference
/home/rguenther/src/gcc2/gcc/testsuite/gfortran.dg/pdt_14.f03:47:0 size
<integer_cst 0x7ffff680cbb8 64> unit-size <integer_cst 0x7ffff680cbd0 8>
align:64 warn_if_not_align:0 context <function_decl 0x7ffff69e0400
pop_8> arg-type <reference_type 0x7ffff69ec000>>
(gdb) p debug_tree (0x7ffff69e3000)
<pointer_type 0x7ffff69e3000
type <record_type 0x7ffff69dcf18 Pdtlink_8 BLK
size <integer_cst 0x7ffff682a078 constant 192>
unit-size <integer_cst 0x7ffff682a048 constant 24>
align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff69dcf18
and in ch2701 the root variable is
var_decl 0x7ffff69f6900 root type <pointer_type 0x7ffff69fb0a8>
addressable used unsigned DI
/home/rguenther/src/gcc2/gcc/testsuite/gfortran.dg/pdt_14.f03:78:48 size
<integer_cst 0x7ffff680cbb8 64> unit-size <integer_cst 0x7ffff680cbd0 8>
align:64 warn_if_not_align:0 context <function_decl 0x7ffff69e0b00
ch2701>>
(gdb) p debug_tree (0x7ffff69fb0a8)
<pointer_type 0x7ffff69fb0a8
type <record_type 0x7ffff69fb2a0 pdtlink_8 BLK
size <integer_cst 0x7ffff682a078 constant 192>
unit-size <integer_cst 0x7ffff682a048 constant 24>
align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff69fb2a0
which is a different type. The latter is created here:
#0 0x0000000000c1d6f2 in gfc_get_derived_type (derived=0x39ebb70, codimen=0)
at /home/rguenther/src/gcc2/gcc/fortran/trans-types.c:2647
#1 0x0000000000c18c21 in gfc_typenode_for_spec (spec=0x39eb090, codim=0)
at /home/rguenther/src/gcc2/gcc/fortran/trans-types.c:1167
#2 0x0000000000c1c54b in gfc_sym_type (sym=0x39eb070)
at /home/rguenther/src/gcc2/gcc/fortran/trans-types.c:2252
#3 0x0000000000b701d9 in gfc_get_symbol_decl (sym=0x39eb070)
at /home/rguenther/src/gcc2/gcc/fortran/trans-decl.c:1790
#4 0x0000000000b7fe7f in generate_local_decl (sym=0x39eb070)
at /home/rguenther/src/gcc2/gcc/fortran/trans-decl.c:5948
#5 0x0000000000b1843d in do_traverse_symtree (st=0x39ec880, st_func=0x0,
sym_func=0xb7fdbb <generate_local_decl(gfc_symbol*)>)
at /home/rguenther/src/gcc2/gcc/fortran/symbol.c:4170
#6 0x0000000000b184f8 in gfc_traverse_ns (ns=0x3a2f6d0,
sym_func=0xb7fdbb <generate_local_decl(gfc_symbol*)>)
at /home/rguenther/src/gcc2/gcc/fortran/symbol.c:4195
#7 0x0000000000b80677 in generate_local_vars (ns=0x3a2f6d0)
at /home/rguenther/src/gcc2/gcc/fortran/trans-decl.c:6154
#8 0x0000000000b825af in gfc_generate_function_code (ns=0x3a2f6d0)
at /home/rguenther/src/gcc2/gcc/fortran/trans-decl.c:6812
#9 0x0000000000b3e3fe in gfc_generate_code (ns=0x3a2f6d0)
at /home/rguenther/src/gcc2/gcc/fortran/trans.c:2235
#10 0x0000000000abe7e0 in translate_all_program_units (
gfc_global_ns_list=0x39b18f0)
while the former here:
#0 0x0000000000c1d6f2 in gfc_get_derived_type (derived=0x39c6480, codimen=0)
at /home/rguenther/src/gcc2/gcc/fortran/trans-types.c:2647
#1 0x0000000000c18c21 in gfc_typenode_for_spec (spec=0x39ce5a0, codim=0)
at /home/rguenther/src/gcc2/gcc/fortran/trans-types.c:1167
#2 0x0000000000c1c54b in gfc_sym_type (sym=0x39ce580)
at /home/rguenther/src/gcc2/gcc/fortran/trans-types.c:2252
#3 0x0000000000b701d9 in gfc_get_symbol_decl (sym=0x39ce580)
at /home/rguenther/src/gcc2/gcc/fortran/trans-decl.c:1790
#4 0x0000000000b7dd72 in gfc_create_module_variable (sym=0x39ce580)
at /home/rguenther/src/gcc2/gcc/fortran/trans-decl.c:5339
#5 0x0000000000b1843d in do_traverse_symtree (st=0x3951a30, st_func=0x0,
sym_func=0xb7d65d <gfc_create_module_variable(gfc_symbol*)>)
at /home/rguenther/src/gcc2/gcc/fortran/symbol.c:4170
#6 0x0000000000b184f8 in gfc_traverse_ns (ns=0x39b2f80,
sym_func=0xb7d65d <gfc_create_module_variable(gfc_symbol*)>)
at /home/rguenther/src/gcc2/gcc/fortran/symbol.c:4195
#7 0x0000000000b7fb05 in gfc_generate_module_vars (ns=0x39b2f80)
at /home/rguenther/src/gcc2/gcc/fortran/trans-decl.c:5838
#8 0x0000000000b3e4f4 in gfc_generate_module_code (ns=0x39b2f80)
at /home/rguenther/src/gcc2/gcc/fortran/trans.c:2259
#9 0x0000000000abe712 in translate_all_program_units (
gfc_global_ns_list=0x39b18f0)
there is it seems code to deal with the type already been there but it seems
this handling doesn't work. It does
/* Store up the canonical type to be added to this one. */
if (got_canonical)
{
if (TYPE_CANONICAL (derived->backend_decl))
canonical = TYPE_CANONICAL (derived->backend_decl);
else
canonical = derived->backend_decl;
derived->backend_decl = NULL_TREE;
}
/* derived->backend_decl != 0 means we saw it before, but its
components' backend_decl may have not been built. */
if (derived->backend_decl)
...
else
{
/* We see this derived type first time, so build the type node. */
typenode = make_node (RECORD_TYPE);
TYPE_NAME (typenode) = get_identifier (derived->name);
TYPE_PACKED (typenode) = flag_pack_derived;
derived->backend_decl = typenode;
}
but we enver find a canonical type.
Looks like a latent issue exposed now.