This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [c++] conditional expr abort
- To: Richard Henderson <rth at redhat dot com>
- Subject: Re: [c++] conditional expr abort
- From: Jason Merrill <jason_merrill at redhat dot com>
- Date: 08 Apr 2001 23:55:02 +0100
- Cc: gcc-patches at gcc dot gnu dot org
- References: <20010408124013.A10491@redhat.com>
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
appropriate.
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.
Jason