[C,C++,Ada,Java,F77] opt/5076 and opt/2847

Richard Henderson rth@redhat.com
Wed Jan 30 10:26:00 GMT 2002


On Wed, Jan 30, 2002 at 10:10:59AM -0800, Mark Mitchell wrote:
> I don't know if this works for C++.  Note that in C++ you can do:
> 
>   while (int i = 3) {
>     /* Stuff involving i. */
>   }
> 
> expand_cond is where we emit the declaration for the "i"; if we
> do that after the body, we'll probably be unhappy not to have
> the declaration around.

Well, I know that it doesn't work for c++, but I havn't examined
why yet.  We get a segfault building libstdc++.  I'd only tested
check-gcc before posting.  :-/

> I think we should plan on doing this right (i.e., with the CFG in 3.2)
> but try to fix the expand_end_loop gunk for 3.0.4/3.1 if at all
> possible.

Another option is to output a marker to let expand_end_loop know
where to stop searching.  I'd had a preliminary patch for this
that did in fact solve this case, but thought it was gross.

It was relatively simple though, if you think that's a better way
to go.  It still requires front end changes, since absense of the
marker means we can't rotate the loop (since we have evidence that
we can get it wrong without).


r~



More information about the Gcc-patches mailing list