------- Comment #10 from jvdelisle at gcc dot gnu dot org 2007-05-04 07:39 ------- Comment #9 is a red herring. Using gdb and looking at this at line 2143:
mpz_set (result->value.integer, e->ts.cl->length->value.integer); (gdb) p *e->ts.cl->length $9 = {expr_type = EXPR_CONSTANT, ts = {type = BT_REAL, kind = 4, derived = 0x0, cl = 0x0}, rank = 0, shape = 0x0, symtree = 0x0, ref = 0x0, where = {nextc = 0xef3b0c "2.3) :: s", lb = 0xef3ae0}, from_H = 0, inline_noncopying_intrinsic = 0, con_by_offset = 0x0, value = {logical = 24, integer = {{_mp_alloc = 24, _mp_size = 0, _mp_d = 0x1}}, real = {{ _mpfr_prec = 24, _mpfr_sign = 1, _mpfr_exp = 2, _mpfr_d = 0xf25d08}}, complex = {r = {{_mpfr_prec = 24, _mpfr_sign = 1, _mpfr_exp = 2, _mpfr_d = 0xf25d08}}, i = {{_mpfr_prec = 0, _mpfr_sign = 0, _mpfr_exp = 0, _mpfr_d = 0x0}}}, op = {operator = 24, uop = 0x1, op1 = 0x2, op2 = 0xf25d08}, function = {actual = 0x18, name = 0x1 <Address 0x1 out of bounds>, isym = 0x2, esym = 0xf25d08}, character = {length = 24, string = 0x1 <Address 0x1 out of bounds>}, constructor = 0x18}} The type is real and we are trying to use the value.integer which is probably meaningless. Again, I am unable to really test this, but here is a suggestion: Index: simplify.c =================================================================== --- simplify.c (revision 124405) +++ simplify.c (working copy) @@ -2136,14 +2136,15 @@ gfc_simplify_len (gfc_expr *e) } if (e->ts.cl != NULL && e->ts.cl->length != NULL - && e->ts.cl->length->expr_type == EXPR_CONSTANT) + && e->ts.cl->length->expr_type == EXPR_CONSTANT + && e->ts.cl->length->ts.type == BT_INTEGER) { result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind, &e->where); mpz_set (result->value.integer, e->ts.cl->length->value.integer); return range_check (result, "LEN"); } - + return NULL; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31251