This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Mon, 13 Sep 2004, Mark Mitchell wrote:True. We really want to have additional structure (as Joseph has independently discovered for the C front end) that we maintain only while parsing a single expression, so that we can know about these kinds of things. We also really want to delay calling fold at all, as Nathan has been advocating. But, here it is Stage 3, so I'll get real. :-)
Hmm. I like that this bug is being fixed, of course, but I'm not happy
about the fact that build_modify_expr would now be relying on the highly
non-local property that the only way it can see a MIN_EXPR is from a
COND_EXPR passing through fold. Perhaps we should just not call fold in
the case that is_lvalue holds for the COND_EXPR. This is not a common
idiom, so I'm not very worried about pessimizing slightly in this case...
Hence the question about how much the c++ parser knows about where it is in an expression.
int a, b, c;
(a < b? a : b) = c;
vs.
c = (a < b? a : b);
in both cases all of the operands of the COND_EXPR are potentially lvalues, so locally from the tree expression these two cases appear indistinguishable
I agree it's awkward either way. The proposed approach of justMy objection was not to handling MIN_EXPR/MAX_EXPR in build_modify_expr so much as to the comment that said (paraphrasing) "we know these nodes are side-effect free". I'd feel better if we did the stabilize_expr dan there, maybe...
considering MIN_EXPR and MAX_EXPR as canonical forms of COND_EXPRs,
matches similar representation normalization issues like "X - -1"
being represented as "X + 1", or "if (var)" becoming "if (var != 0)".
Its really no different to gimplification where equivalent expressions
are lowered to the same "simple" form.
-- Mark Mitchell CodeSourcery, LLC (916) 791-8304 mark@codesourcery.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |