error in `expand_expr', at expr.c:6388

Zack Weinberg
Sun May 2 13:52:00 GMT 1999

On Sun, 02 May 1999 23:08:21 GMT+03:00, Alexander Zvyagin wrote:
>Dear egcs developers,
>File g.f:
>      in = 1
>      do while (in.le.nadc.and.IGAMS(2,in)
>      enddo
>      END
>$ g++ -c g.f
>g.f:4: Internal compiler error in `expand_expr', at expr.c:6388
>Please submit a full bug report to `'.
>See <URL: > for details.

This is caused by operations on freed memory.  We call ffeste_R819B
(why is it named this?) to generate RTL for the DO WHILE conditional.
That code does this:

        struct nesting *loop;

        result = ffecom_make_tempvar ("dowhile", integer_type_node,
                                      FFETARGET_charactersizeNONE, -1);
        loop = expand_start_loop (1);

        ffeste_start_stmt_ ();

        ffecom_prepare_expr (expr);
        ffecom_prepare_end ();
        result = ffecom_modify (void_type_node,
                                ffecom_truth_value (ffecom_expr (expr)));
        expand_expr_stmt (result);

        ffeste_end_stmt_ ();

        ffestw_set_do_hook (block, loop);
        expand_exit_loop_if_false (0, result);

`result' is allocated on the saveable_obstack since
ffecom_make_tempvar calls suspend_momentary.  The tree pointed to by
`result', however, is allocated on the momentary_obstack.
ffeste_end_stmt_ calls clear_momentary.  Oops.

Moving the ffeste_end_stmt_ call after the call to
expand_exit_loop_if_false prevents the ICE.  However, I am not certain
whether the generated code is correct.  Even if it is, this might not
be the right fix; I do not know the Fortran front end very well.


More information about the Gcc-bugs mailing list