[c++] conditional expr abort

Jason Merrill jason_merrill@redhat.com
Sun Apr 8 15:55:00 GMT 2001

The way the rest of the frontend seems to handle this sort of situation is
to fold the lvalue-using operation down into the COND_EXPR; see
rationalize_conditional_expr, build_modify_expr, and build_component_ref,
for instance.  I think that doing the same in build_array_ref would be

The alternative approach used in your patch, of taking the addresses of the
branches and then dereferencing the result, makes a lot of logical sense,
and is probably less fragile.  The existing strategy was inherited from the
GCC pseudo-lvalues extension, and doesn't make as much sense for true
lvalues.  But your scheme also probably produces worse code due to missed
optimization opportunities and unnecessary address-taking.

I think my inclination would be to change build_array_ref to work like the
others for 3.0, and possibly consider changing how we deal with lvalues
later on.


More information about the Gcc-patches mailing list