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

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

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

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
GCC11 and GCC7 give

pr96025.f90:4:13:

    4 |    character(char(1)) function f()
      |             1
Error: Expression at (1) must be of INTEGER type, found CHARACTER

but the instrumented compiler gives

==71986==ERROR: AddressSanitizer: heap-use-after-free on address 0x604000000f90
at pc 0x00010015d5e6 bp 0x7ffeefbfe490 sp 0x7ffeefbfe488
READ of size 8 at 0x604000000f90 thread T0
    #0 0x10015d5e5 in gfc_traverse_expr(gfc_expr*, gfc_symbol*, bool
(*)(gfc_expr*, gfc_symbol*, int*), int) expr.c:5217
    #1 0x1001709cb in gfc_expr_check_typed(gfc_expr*, gfc_namespace*, bool)
expr.c:5475
    #2 0x1003575e0 in check_function_result_typed() parse.c:3720
    #3 0x10036b22d in parse_spec(gfc_statement) parse.c:3827
    #4 0x100371f06 in parse_progunit(gfc_statement) parse.c:5852
    #5 0x100372910 in parse_contained(int) parse.c:5753
    #6 0x1003724c5 in parse_progunit(gfc_statement) parse.c:5924
    #7 0x10037465f in gfc_parse_file() parse.c:6393
    #8 0x10055a224 in gfc_be_parse_file() f95-lang.c:212
    #9 0x106b46254 in compile_file() toplev.c:458
    #10 0x106b552e3 in do_compile() toplev.c:2307
    #11 0x10a42f19e in toplev::main(int, char**) toplev.c:2446
    #12 0x10a933d44 in main main.c:39
    #13 0x7fff6bb23cc8 in start+0x0 (libdyld.dylib:x86_64+0x1acc8)

0x604000000f90 is located 0 bytes inside of 48-byte region
[0x604000000f90,0x604000000fc0)
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 0x1000f59ce in gfc_match_prefix(gfc_typespec*) decl.c:6317
    #6 0x100364d2d in match_deferred_characteristics(gfc_typespec*)
parse.c:3666
    #7 0x10036ba1e in parse_spec(gfc_statement) parse.c:3936
    #8 0x100371f06 in parse_progunit(gfc_statement) parse.c:5852
    #9 0x100372910 in parse_contained(int) parse.c:5753
    #10 0x1003724c5 in parse_progunit(gfc_statement) parse.c:5924
    #11 0x10037465f in gfc_parse_file() parse.c:6393
    #12 0x10055a224 in gfc_be_parse_file() f95-lang.c:212
    #13 0x106b46254 in compile_file() toplev.c:458
    #14 0x106b552e3 in do_compile() toplev.c:2307
    #15 0x10a42f19e in toplev::main(int, char**) toplev.c:2446
    #16 0x10a933d44 in main main.c:39
    #17 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 0x1000f59ce in gfc_match_prefix(gfc_typespec*) decl.c:6317
    #9 0x100364d2d in match_deferred_characteristics(gfc_typespec*)
parse.c:3666
    #10 0x10036ba1e in parse_spec(gfc_statement) parse.c:3936
    #11 0x100371f06 in parse_progunit(gfc_statement) parse.c:5852
    #12 0x100372910 in parse_contained(int) parse.c:5753
    #13 0x1003724c5 in parse_progunit(gfc_statement) parse.c:5924
    #14 0x10037465f in gfc_parse_file() parse.c:6393
    #15 0x10055a224 in gfc_be_parse_file() f95-lang.c:212
    #16 0x106b46254 in compile_file() toplev.c:458
    #17 0x106b552e3 in do_compile() toplev.c:2307
    #18 0x10a42f19e in toplev::main(int, char**) toplev.c:2446
    #19 0x10a933d44 in main main.c:39
    #20 0x7fff6bb23cc8 in start+0x0 (libdyld.dylib:x86_64+0x1acc8)


For GCC8 to GCC10 I get a

(null):0: confused by earlier errors, bailing out

(release builds)/

Reply via email to