[Bug fortran/96024] [9/10/11 Regression] ICE in mio_name_expr_t, at fortran/module.c:2159

dominiq at lps dot ens.fr gcc-bugzilla@gcc.gnu.org
Wed Jul 1 20:11:50 GMT 2020


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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-07-01
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed from GCC8 up to master. My instrumented compiler gives

==36165==ERROR: AddressSanitizer: heap-use-after-free on address 0x604000001090
at pc 0x0001002a7c06 bp 0x7ffeefbfe5c0 sp 0x7ffeefbfe5b8
READ of size 8 at 0x604000001090 thread T0
    #0 0x1002a7c05 in mio_expr(gfc_expr**) module.c:3560
    #1 0x1002a9986 in mio_charlen(gfc_charlen**) module.c:2629
    #2 0x1002aa123 in mio_typespec(gfc_typespec*) module.c:2687
    #3 0x1002a7aec in mio_expr(gfc_expr**) module.c:3586
    #4 0x1002a9986 in mio_charlen(gfc_charlen**) module.c:2629
    #5 0x1002aa123 in mio_typespec(gfc_typespec*) module.c:2687
    #6 0x1002ac779 in mio_component(gfc_component*, int) module.c:2920
    #7 0x1002acf76 in mio_component_list(gfc_component**, int) module.c:2957
    #8 0x1002b221e in mio_symbol(gfc_symbol*) module.c:4416
    #9 0x1002b3416 in write_symbol(int, gfc_symbol*) module.c:5771
    #10 0x1002bd091 in write_symbol0(gfc_symtree*) module.c:5811
    #11 0x1002bcc9f in write_symbol0(gfc_symtree*) module.c:5790
    #12 0x1002bcc9f in write_symbol0(gfc_symtree*) module.c:5790
    #13 0x1002bd74a in write_module() module.c:6153
    #14 0x1002bdc02 in dump_module(char const*, int) module.c:6283
    #15 0x1002be369 in gfc_dump_module(char const*, int) module.c:6340
    #16 0x100374c6f in gfc_parse_file() parse.c:6457
    #17 0x10055a224 in gfc_be_parse_file() f95-lang.c:212
    #18 0x106b46254 in compile_file() toplev.c:458
    #19 0x106b552e3 in do_compile() toplev.c:2307
    #20 0x10a42f19e in toplev::main(int, char**) toplev.c:2446
    #21 0x10a933d44 in main main.c:39
    #22 0x7fff6bb23cc8 in start+0x0 (libdyld.dylib:x86_64+0x1acc8)

0x604000001090 is located 0 bytes inside of 48-byte region
[0x604000001090,0x6040000010c0)
freed by thread T0 here:
    #0 0x15b8378f7 in wrap_free.part.0+0x97 (libasan.6.dylib:x86_64+0x4a8f7)
    #1 0x10050d6db in gfc_free_charlen(gfc_charlen*, gfc_charlen*)
symbol.c:3990
    #2 0x10050da95 in gfc_free_namespace(gfc_namespace*) symbol.c:4041
    #3 0x1000d5a47 in gfc_match_char_spec(gfc_typespec*) decl.c:3506
    #4 0x1000f171d in gfc_match_decl_type_spec(gfc_typespec*, int) decl.c:4166
    #5 0x100105f3c in gfc_match_data_decl() decl.c:6126
    #6 0x100354b42 in match_word(char const*, match (*)(), locus*) parse.c:65
    #7 0x100361a89 in decode_statement() parse.c:376
    #8 0x100363fdd in next_free() parse.c:1280
    #9 0x10036499a in next_statement() parse.c:1512
    #10 0x100369ab2 in parse_derived() parse.c:3343
    #11 0x10036b617 in parse_spec(gfc_statement) parse.c:3883
    #12 0x100373a04 in parse_module() parse.c:6116
    #13 0x100374976 in gfc_parse_file() parse.c:6421
    #14 0x10055a224 in gfc_be_parse_file() f95-lang.c:212
    #15 0x106b46254 in compile_file() toplev.c:458
    #16 0x106b552e3 in do_compile() toplev.c:2307
    #17 0x10a42f19e in toplev::main(int, char**) toplev.c:2446
    #18 0x10a933d44 in main main.c:39
    #19 0x7fff6bb23cc8 in start+0x0 (libdyld.dylib:x86_64+0x1acc8)

previously allocated by thread T0 here:
    #0 0x15b837fff in wrap_calloc+0xbf (libasan.6.dylib:x86_64+0x4afff)
    #1 0x109833754 in xcalloc xmalloc.c:162
    #2 0x10050b457 in gfc_new_charlen(gfc_namespace*, gfc_charlen*)
symbol.c:3954
    #3 0x10044a874 in fixup_charlen(gfc_expr*) resolve.c:6078
    #4 0x10041538e in gfc_resolve_expr(gfc_expr*) resolve.c:7108
    #5 0x1001650df in gfc_reduce_init_expr(gfc_expr*) expr.c:3085
    #6 0x1000d59b5 in gfc_match_char_spec(gfc_typespec*) decl.c:3496
    #7 0x1000f171d in gfc_match_decl_type_spec(gfc_typespec*, int) decl.c:4166
    #8 0x100105f3c in gfc_match_data_decl() decl.c:6126
    #9 0x100354b42 in match_word(char const*, match (*)(), locus*) parse.c:65
    #10 0x100361a89 in decode_statement() parse.c:376
    #11 0x100363fdd in next_free() parse.c:1280
    #12 0x10036499a in next_statement() parse.c:1512
    #13 0x100369ab2 in parse_derived() parse.c:3343
    #14 0x10036b617 in parse_spec(gfc_statement) parse.c:3883
    #15 0x100373a04 in parse_module() parse.c:6116
    #16 0x100374976 in gfc_parse_file() parse.c:6421
    #17 0x10055a224 in gfc_be_parse_file() f95-lang.c:212
    #18 0x106b46254 in compile_file() toplev.c:458
    #19 0x106b552e3 in do_compile() toplev.c:2307
    #20 0x10a42f19e in toplev::main(int, char**) toplev.c:2446
    #21 0x10a933d44 in main main.c:39
    #22 0x7fff6bb23cc8 in start+0x0 (libdyld.dylib:x86_64+0x1acc8)
...

GCC7 combles the code without error.


More information about the Gcc-bugs mailing list