https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103371
Bug ID: 103371 Summary: f951: internal compiler error: Aborted (free(): double free detected in tcache 2) when giving diagnostics on type of a parameter expression Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: error-recovery Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: asolokha at gmx dot com Target Milestone: --- Created attachment 51852 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51852&action=edit Testcase gfortran-12.0.0-alpha20211121 snapshot (g:da17c304e22ba256eba0b03710aa329115163b08) ICEs when compiling test/Semantics/resolve92.f90 from the flang 13.0.0 test suite: % gfortran-12.0.0 -c flang/test/Semantics/resolve92.f90 flang/test/Semantics/resolve92.f90:21:14: 21 | integer(t) :: n | 1 Error: Function 't' requires an argument list at (1) free(): double free detected in tcache 2 f951: internal compiler error: Aborted 0xf2fc4f crash_signal /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/toplev.c:322 0x889ed8 gfc_free_actual_arglist(gfc_actual_arglist*) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/fortran/expr.c:547 0x878bc9 gfc_match_data_decl() /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/fortran/decl.c:6340 0x8ebb04 match_word /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/fortran/parse.c:67 0x8ebb04 decode_statement /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/fortran/parse.c:378 0x8f28c4 next_free /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/fortran/parse.c:1397 0x8f28c4 next_statement /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/fortran/parse.c:1629 0x8f4fe4 parse_derived /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/fortran/parse.c:3588 0x8f4fe4 parse_spec /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/fortran/parse.c:4129 0x8f9428 parse_module /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/fortran/parse.c:6443 0x8f999f gfc_parse_file() /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/fortran/parse.c:6760 0x94c16f gfc_be_parse_file /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/fortran/f95-lang.c:216 ==1403603== Invalid read of size 8 ==1403603== at 0x889EB3: gfc_free_actual_arglist(gfc_actual_arglist*) (expr.c:545) ==1403603== by 0x878BC9: gfc_match_data_decl() (decl.c:6340) ==1403603== by 0x8EBB04: match_word (parse.c:67) ==1403603== by 0x8EBB04: decode_statement() (parse.c:378) ==1403603== by 0x8F28C4: next_free (parse.c:1397) ==1403603== by 0x8F28C4: next_statement() (parse.c:1629) ==1403603== by 0x8F4FE4: parse_derived (parse.c:3588) ==1403603== by 0x8F4FE4: parse_spec(gfc_statement) (parse.c:4129) ==1403603== by 0x8F9428: parse_module() (parse.c:6443) ==1403603== by 0x8F999F: gfc_parse_file() (parse.c:6760) ==1403603== by 0x94C16F: gfc_be_parse_file() (f95-lang.c:216) ==1403603== by 0xF2FD40: compile_file() (toplev.c:452) ==1403603== by 0x849580: do_compile (toplev.c:2156) ==1403603== by 0x849580: toplev::main(int, char**) (toplev.c:2308) ==1403603== by 0x84B19B: main (main.c:39) ==1403603== Address 0x50bdf38 is 24 bytes inside a block of size 48 free'd ==1403603== at 0x4840CDB: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==1403603== by 0x889ED8: gfc_free_actual_arglist(gfc_actual_arglist*) (expr.c:547) ==1403603== by 0x870EFB: gfc_get_pdt_instance(gfc_actual_arglist*, gfc_symbol**, gfc_actual_arglist**) (decl.c:4165) ==1403603== by 0x90C454: resolve_structure_cons(gfc_expr*, int) (resolve.c:1279) ==1403603== by 0x90F23A: resolve_generic_f (resolve.c:2806) ==1403603== by 0x90F23A: resolve_function (resolve.c:3321) ==1403603== by 0x90F23A: gfc_resolve_expr(gfc_expr*) [clone .part.0] (resolve.c:7166) ==1403603== by 0x88D595: gfc_reduce_init_expr(gfc_expr*) (expr.c:3130) ==1403603== by 0x891002: gfc_match_init_expr(gfc_expr**) (expr.c:3178) ==1403603== by 0x879A9E: variable_decl (decl.c:3004) ==1403603== by 0x879A9E: gfc_match_data_decl() (decl.c:6297) ==1403603== by 0x8EBB04: match_word (parse.c:67) ==1403603== by 0x8EBB04: decode_statement() (parse.c:378) ==1403603== by 0x8F28C4: next_free (parse.c:1397) ==1403603== by 0x8F28C4: next_statement() (parse.c:1629) ==1403603== by 0x8F4FE4: parse_derived (parse.c:3588) ==1403603== by 0x8F4FE4: parse_spec(gfc_statement) (parse.c:4129) ==1403603== by 0x8F9428: parse_module() (parse.c:6443) ==1403603== Block was alloc'd at ==1403603== at 0x484314F: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==1403603== by 0x1EEC4B4: xcalloc (xmalloc.c:164) ==1403603== by 0x870F3C: gfc_get_pdt_instance(gfc_actual_arglist*, gfc_symbol**, gfc_actual_arglist**) (decl.c:3855) ==1403603== by 0x90C454: resolve_structure_cons(gfc_expr*, int) (resolve.c:1279) ==1403603== by 0x90F23A: resolve_generic_f (resolve.c:2806) ==1403603== by 0x90F23A: resolve_function (resolve.c:3321) ==1403603== by 0x90F23A: gfc_resolve_expr(gfc_expr*) [clone .part.0] (resolve.c:7166) ==1403603== by 0x88D595: gfc_reduce_init_expr(gfc_expr*) (expr.c:3130) ==1403603== by 0x891002: gfc_match_init_expr(gfc_expr**) (expr.c:3178) ==1403603== by 0x879A9E: variable_decl (decl.c:3004) ==1403603== by 0x879A9E: gfc_match_data_decl() (decl.c:6297) ==1403603== by 0x8EBB04: match_word (parse.c:67) ==1403603== by 0x8EBB04: decode_statement() (parse.c:378) ==1403603== by 0x8F28C4: next_free (parse.c:1397) ==1403603== by 0x8F28C4: next_statement() (parse.c:1629) ==1403603== by 0x8F4FE4: parse_derived (parse.c:3588) ==1403603== by 0x8F4FE4: parse_spec(gfc_statement) (parse.c:4129) ==1403603== by 0x8F9428: parse_module() (parse.c:6443) ==1403603== ==1403603== Invalid read of size 8 ==1403603== at 0x889EB8: gfc_free_actual_arglist(gfc_actual_arglist*) (expr.c:544) ==1403603== by 0x878BC9: gfc_match_data_decl() (decl.c:6340) ==1403603== by 0x8EBB04: match_word (parse.c:67) ==1403603== by 0x8EBB04: decode_statement() (parse.c:378) ==1403603== by 0x8F28C4: next_free (parse.c:1397) ==1403603== by 0x8F28C4: next_statement() (parse.c:1629) ==1403603== by 0x8F4FE4: parse_derived (parse.c:3588) ==1403603== by 0x8F4FE4: parse_spec(gfc_statement) (parse.c:4129) ==1403603== by 0x8F9428: parse_module() (parse.c:6443) ==1403603== by 0x8F999F: gfc_parse_file() (parse.c:6760) ==1403603== by 0x94C16F: gfc_be_parse_file() (f95-lang.c:216) ==1403603== by 0xF2FD40: compile_file() (toplev.c:452) ==1403603== by 0x849580: do_compile (toplev.c:2156) ==1403603== by 0x849580: toplev::main(int, char**) (toplev.c:2308) ==1403603== by 0x84B19B: main (main.c:39) ==1403603== Address 0x50bdf48 is 40 bytes inside a block of size 48 free'd ==1403603== at 0x4840CDB: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==1403603== by 0x889ED8: gfc_free_actual_arglist(gfc_actual_arglist*) (expr.c:547) ==1403603== by 0x870EFB: gfc_get_pdt_instance(gfc_actual_arglist*, gfc_symbol**, gfc_actual_arglist**) (decl.c:4165) ==1403603== by 0x90C454: resolve_structure_cons(gfc_expr*, int) (resolve.c:1279) ==1403603== by 0x90F23A: resolve_generic_f (resolve.c:2806) ==1403603== by 0x90F23A: resolve_function (resolve.c:3321) ==1403603== by 0x90F23A: gfc_resolve_expr(gfc_expr*) [clone .part.0] (resolve.c:7166) ==1403603== by 0x88D595: gfc_reduce_init_expr(gfc_expr*) (expr.c:3130) ==1403603== by 0x891002: gfc_match_init_expr(gfc_expr**) (expr.c:3178) ==1403603== by 0x879A9E: variable_decl (decl.c:3004) ==1403603== by 0x879A9E: gfc_match_data_decl() (decl.c:6297) ==1403603== by 0x8EBB04: match_word (parse.c:67) ==1403603== by 0x8EBB04: decode_statement() (parse.c:378) ==1403603== by 0x8F28C4: next_free (parse.c:1397) ==1403603== by 0x8F28C4: next_statement() (parse.c:1629) ==1403603== by 0x8F4FE4: parse_derived (parse.c:3588) ==1403603== by 0x8F4FE4: parse_spec(gfc_statement) (parse.c:4129) ==1403603== by 0x8F9428: parse_module() (parse.c:6443) ==1403603== Block was alloc'd at ==1403603== at 0x484314F: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==1403603== by 0x1EEC4B4: xcalloc (xmalloc.c:164) ==1403603== by 0x870F3C: gfc_get_pdt_instance(gfc_actual_arglist*, gfc_symbol**, gfc_actual_arglist**) (decl.c:3855) ==1403603== by 0x90C454: resolve_structure_cons(gfc_expr*, int) (resolve.c:1279) ==1403603== by 0x90F23A: resolve_generic_f (resolve.c:2806) ==1403603== by 0x90F23A: resolve_function (resolve.c:3321) ==1403603== by 0x90F23A: gfc_resolve_expr(gfc_expr*) [clone .part.0] (resolve.c:7166) ==1403603== by 0x88D595: gfc_reduce_init_expr(gfc_expr*) (expr.c:3130) ==1403603== by 0x891002: gfc_match_init_expr(gfc_expr**) (expr.c:3178) ==1403603== by 0x879A9E: variable_decl (decl.c:3004) ==1403603== by 0x879A9E: gfc_match_data_decl() (decl.c:6297) ==1403603== by 0x8EBB04: match_word (parse.c:67) ==1403603== by 0x8EBB04: decode_statement() (parse.c:378) ==1403603== by 0x8F28C4: next_free (parse.c:1397) ==1403603== by 0x8F28C4: next_statement() (parse.c:1629) ==1403603== by 0x8F4FE4: parse_derived (parse.c:3588) ==1403603== by 0x8F4FE4: parse_spec(gfc_statement) (parse.c:4129) ==1403603== by 0x8F9428: parse_module() (parse.c:6443) ==1403603== ==1403603== Invalid free() / delete / delete[] / realloc() ==1403603== at 0x4840CDB: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==1403603== by 0x889ED8: gfc_free_actual_arglist(gfc_actual_arglist*) (expr.c:547) ==1403603== by 0x878BC9: gfc_match_data_decl() (decl.c:6340) ==1403603== by 0x8EBB04: match_word (parse.c:67) ==1403603== by 0x8EBB04: decode_statement() (parse.c:378) ==1403603== by 0x8F28C4: next_free (parse.c:1397) ==1403603== by 0x8F28C4: next_statement() (parse.c:1629) ==1403603== by 0x8F4FE4: parse_derived (parse.c:3588) ==1403603== by 0x8F4FE4: parse_spec(gfc_statement) (parse.c:4129) ==1403603== by 0x8F9428: parse_module() (parse.c:6443) ==1403603== by 0x8F999F: gfc_parse_file() (parse.c:6760) ==1403603== by 0x94C16F: gfc_be_parse_file() (f95-lang.c:216) ==1403603== by 0xF2FD40: compile_file() (toplev.c:452) ==1403603== by 0x849580: do_compile (toplev.c:2156) ==1403603== by 0x849580: toplev::main(int, char**) (toplev.c:2308) ==1403603== by 0x84B19B: main (main.c:39) ==1403603== Address 0x50bdf20 is 0 bytes inside a block of size 48 free'd ==1403603== at 0x4840CDB: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==1403603== by 0x889ED8: gfc_free_actual_arglist(gfc_actual_arglist*) (expr.c:547) ==1403603== by 0x870EFB: gfc_get_pdt_instance(gfc_actual_arglist*, gfc_symbol**, gfc_actual_arglist**) (decl.c:4165) ==1403603== by 0x90C454: resolve_structure_cons(gfc_expr*, int) (resolve.c:1279) ==1403603== by 0x90F23A: resolve_generic_f (resolve.c:2806) ==1403603== by 0x90F23A: resolve_function (resolve.c:3321) ==1403603== by 0x90F23A: gfc_resolve_expr(gfc_expr*) [clone .part.0] (resolve.c:7166) ==1403603== by 0x88D595: gfc_reduce_init_expr(gfc_expr*) (expr.c:3130) ==1403603== by 0x891002: gfc_match_init_expr(gfc_expr**) (expr.c:3178) ==1403603== by 0x879A9E: variable_decl (decl.c:3004) ==1403603== by 0x879A9E: gfc_match_data_decl() (decl.c:6297) ==1403603== by 0x8EBB04: match_word (parse.c:67) ==1403603== by 0x8EBB04: decode_statement() (parse.c:378) ==1403603== by 0x8F28C4: next_free (parse.c:1397) ==1403603== by 0x8F28C4: next_statement() (parse.c:1629) ==1403603== by 0x8F4FE4: parse_derived (parse.c:3588) ==1403603== by 0x8F4FE4: parse_spec(gfc_statement) (parse.c:4129) ==1403603== by 0x8F9428: parse_module() (parse.c:6443) ==1403603== Block was alloc'd at ==1403603== at 0x484314F: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==1403603== by 0x1EEC4B4: xcalloc (xmalloc.c:164) ==1403603== by 0x870F3C: gfc_get_pdt_instance(gfc_actual_arglist*, gfc_symbol**, gfc_actual_arglist**) (decl.c:3855) ==1403603== by 0x90C454: resolve_structure_cons(gfc_expr*, int) (resolve.c:1279) ==1403603== by 0x90F23A: resolve_generic_f (resolve.c:2806) ==1403603== by 0x90F23A: resolve_function (resolve.c:3321) ==1403603== by 0x90F23A: gfc_resolve_expr(gfc_expr*) [clone .part.0] (resolve.c:7166) ==1403603== by 0x88D595: gfc_reduce_init_expr(gfc_expr*) (expr.c:3130) ==1403603== by 0x891002: gfc_match_init_expr(gfc_expr**) (expr.c:3178) ==1403603== by 0x879A9E: variable_decl (decl.c:3004) ==1403603== by 0x879A9E: gfc_match_data_decl() (decl.c:6297) ==1403603== by 0x8EBB04: match_word (parse.c:67) ==1403603== by 0x8EBB04: decode_statement() (parse.c:378) ==1403603== by 0x8F28C4: next_free (parse.c:1397) ==1403603== by 0x8F28C4: next_statement() (parse.c:1629) ==1403603== by 0x8F4FE4: parse_derived (parse.c:3588) ==1403603== by 0x8F4FE4: parse_spec(gfc_statement) (parse.c:4129) ==1403603== by 0x8F9428: parse_module() (parse.c:6443) ==1403603==