[Bug fortran/49430] ICE with allocatable length character in interface block
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49430 janus at gcc dot gnu.org changed: What|Removed |Added CC||janus at gcc dot gnu.org --- Comment #2 from janus at gcc dot gnu.org 2011-06-21 19:40:25 UTC --- The same error occurs for the test case in PR 49112 comment 7: module datetime_mod implicit none private type :: DateTime contains procedure :: getFormattedString end type contains function getTimeString(dt, FMT) result(string) character(:), allocatable :: string class(DateTime), intent(IN) :: dt integer, optional, intent(IN) :: FMT string = dt%getFormattedString(2, FMT) end function function getFormattedString(this, FILTER, FMT) result(string) character(:), allocatable :: string class(DateTime), intent(IN) :: this integer, optional, intent(IN) :: FILTER, FMT end function end module c7.f90: In function ‘gettimestring’: c7.f90:18:0: internal compiler error: tree check: expected tree that contains ‘typed’ structure, have ‘’ in fold_convert_loc, at fold-const.c:1859
[Bug fortran/49430] ICE with allocatable length character in interface block
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49430 janus at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2011.06.21 20:21:29 Ever Confirmed|0 |1 --- Comment #3 from janus at gcc dot gnu.org 2011-06-21 20:21:29 UTC --- (In reply to comment #1) I wonder whether the 3538 type = gfc_get_character_type (ts.kind, ts.u.cl); should be rather: type = gfc_get_character_type (ts.kind, ts-deferred ? NULL_TREE : ts.u.cl); Well, with this: Index: gcc/fortran/trans-expr.c === --- gcc/fortran/trans-expr.c(revision 175256) +++ gcc/fortran/trans-expr.c(working copy) @@ -3535,7 +3535,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * else if (ts.type == BT_CHARACTER) { /* Pass the string length. */ - type = gfc_get_character_type (ts.kind, ts.u.cl); + type = gfc_get_character_type (ts.kind, + ts.deferred ? NULL_TREE : ts.u.cl); type = build_pointer_type (type); /* Return an address to a char[0:len-1]* temporary for I run into another segfault: #0 0x00575a6d in gfc_evaluate_now_loc (loc=2308, expr=0x0, pblock=0x7fffd560) at /home/jweil/gcc47/trunk/gcc/fortran/trans.c:126 #1 0x00575b40 in gfc_evaluate_now (expr=0x0, pblock=0x7fffd560) at /home/jweil/gcc47/trunk/gcc/fortran/trans.c:139 #2 0x005ca23b in gfc_trans_assignment_1 (expr1=0x1af3df0, expr2=0x1af3eb0, init_flag=0 '\000', dealloc=1 '\001') at /home/jweil/gcc47/trunk/gcc/fortran/trans-expr.c:6117
[Bug fortran/49430] ICE with allocatable length character in interface block
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49430 --- Comment #4 from janus at gcc dot gnu.org 2011-06-21 21:18:50 UTC --- Slightly reduced/modified test case, giving a different error: abstract interface function messageProcedure() character(:), allocatable :: messageProcedure end function end interface type :: ctype procedure(messageProcedure), pointer, nopass :: getMessage end type type(ctype) :: this character :: message message = this%getMessage() end internal compiler error: vector VEC(tree,base) index domain error, in gfc_conv_procedure_call at fortran/trans-expr.c:3387
[Bug fortran/49430] ICE with allocatable length character in interface block
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49430 --- Comment #5 from janus at gcc dot gnu.org 2011-06-21 21:37:27 UTC --- Comment #4 can be fixed with the following patch: Index: gcc/fortran/trans-expr.c === --- gcc/fortran/trans-expr.c(revision 175256) +++ gcc/fortran/trans-expr.c(working copy) @@ -3381,7 +3381,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * we take the character length of the first argument for the result. For dummies, we have to look through the formal argument list for this function and use the character length found there.*/ - if (ts.deferred (sym-attr.allocatable || sym-attr.pointer)) + if (ts.deferred) cl.backend_decl = gfc_create_var (gfc_charlen_type_node, slen); else if (!sym-attr.dummy) cl.backend_decl = VEC_index (tree, stringargs, 0); @@ -6112,7 +6112,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr gfc_conv_expr (rse, expr2); /* Stabilize a string length for temporaries. */ - if (expr2-ts.type == BT_CHARACTER) + if (expr2-ts.type == BT_CHARACTER !expr2-ts.deferred) string_length = gfc_evaluate_now (rse.string_length, rse.pre); else string_length = NULL_TREE;
[Bug fortran/49430] ICE with allocatable length character in interface block
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49430 Tobias Burnus burnus at gcc dot gnu.org changed: What|Removed |Added Keywords||ice-on-valid-code CC||burnus at gcc dot gnu.org Blocks||45170 --- Comment #1 from Tobias Burnus burnus at gcc dot gnu.org 2011-06-15 23:43:42 UTC --- I get: test.f90:19:0: internal compiler error: tree check: expected tree that contains 'typed' structure, have '�' in fold_convert_loc, at fold-const.c:1859 ==14082== Invalid read of size 1 ==14082==at 0x72F9B2: fold_convert_loc (fold-const.c:1859) ==14082==by 0xA7D3F6: build_range_type_1 (tree.c:7170) ==14082==by 0x5C8C69: gfc_get_character_type_len_for_eltype (trans-types.c:977) ==14082==by 0x59EA63: gfc_conv_procedure_call (trans-expr.c:3538) ==14082==by 0x59F271: gfc_conv_function_expr (trans-expr.c:4082) ==14082==by 0x597D01: gfc_trans_assignment_1 (trans-expr.c:6112) In trans-expr.c:3538: (gdb) p *ts.u.cl $2 = {length = 0x0, next = 0x0, length_from_typespec = 215 '\327', backend_decl = 0x1535340, passed_length = 0x2cdd7f00, resolved = 6764539} I wonder whether the 3538 type = gfc_get_character_type (ts.kind, ts.u.cl); should be rather: type = gfc_get_character_type (ts.kind, ts-deferred ? NULL_TREE : ts.u.cl);