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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #6 from kargl at gcc dot gnu.org ---
Janus,

I updated my source tree to r243203, which includes your change.
My source tree cuurently has no other changes.  I still see an ICE.
However, an error message is printed.

troutmask:sgk[232] gfc7 -o z char_conversion.f90 
char_conversion.f90:8:30:

    character, parameter :: c = char(256,4) ! { dg-error "cannot be converted"
}
                              1
Error: Character '\u0100' in string at (1) cannot be converted into character
kind 1
f951: internal compiler error: Segmentation fault
0xbb020f crash_signal
        ../../gcc7/gcc/toplev.c:333
0x5f0662 gfc_is_constant_expr(gfc_expr*)
        ../../gcc7/gcc/fortran/expr.c:899
0x658e21 resolve_fl_procedure
        ../../gcc7/gcc/fortran/resolve.c:12013
0x658e21 resolve_symbol
        ../../gcc7/gcc/fortran/resolve.c:14721
0x67755b do_traverse_symtree
        ../../gcc7/gcc/fortran/symbol.c:3994
0x6523a4 resolve_types
        ../../gcc7/gcc/fortran/resolve.c:15948
0x656b2c gfc_resolve(gfc_namespace*)
        ../../gcc7/gcc/fortran/resolve.c:16061
0x645ef4 resolve_all_program_units
        ../../gcc7/gcc/fortran/parse.c:5977
0x645ef4 gfc_parse_file()
        ../../gcc7/gcc/fortran/parse.c:6224
0x68a3c2 gfc_be_parse_file
        ../../gcc7/gcc/fortran/f95-lang.c:202

Running f951 under gdb shows

(gdb) run char_conversion.f90 
Starting program:
/mnt/sgk/work/7/libexec/gcc/x86_64-unknown-freebsd12.0/7.0.0/f951
char_conversion.f90
char_conversion.f90:8:30:

    character, parameter :: c = char(256,4) ! { dg-error "cannot be converted"
}
                              1
Error: Character '\u0100' in string at (1) cannot be converted into character
kind 1

Program received signal SIGSEGV, Segmentation fault.
gfc_is_constant_expr (e=0x193e) at ../../gcc7/gcc/fortran/expr.c:899
899       switch (e->expr_type)

0x193e is certainly an invalid pointer.

(gdb) up
#1  0x0000000000658e22 in resolve_fl_procedure (mp_flag=0, sym=0x203636180)
    at ../../gcc7/gcc/fortran/resolve.c:12013
12013         if (cl && cl->length && gfc_is_constant_expr (cl->length)
(gdb) p *sym
$1 = {name = 0x20382c9d0 "__convert_s4_s1", 
(gdb) p *sym->ts.u.cl
$4 = {length = 0x193e, next = 0x0, length_from_typespec = false, 
  backend_decl = 0x2039d5020, passed_length = 0x0, resolved = 56844352}

Reply via email to