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

Zack Weinberg zack@rabi.columbia.edu
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:
>      SUBROUTINE G(IGAMS,IWRK,NADC,NCellsInY)
>      INTEGER*2 IGAMS(2,NADC)
>      in = 1
>      do while (in.le.nadc.and.IGAMS(2,in).le.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 `egcs-bugs@egcs.cygnus.com'.
>See <URL: http://egcs.cygnus.com/faq.html#bugreport > 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,
                                result,
                                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.

zw



More information about the Gcc-bugs mailing list