This is the mail archive of the
mailing list for the GCC project.
Re: [RFC] fold Reorganization Plan
Can a compile-time constant appearing in an initializer be as wild as
0 ? (foo () + 9) : (3 + 5)
Here (foo () + 9) does not fold to a constant, but the whole
expression does fold to 8.
Well, it depends on the FE's language definition :) For C and C++ the
above is not a constant-expression as the language defines it. I can
see a couple of obvious ways to deal with this with an FE specific
constant expression evaluator,
1) during parsing set a flag if the expression contains something
not permitted for a constant-expresssion
2) a lazy folder returns 'error' when it meets something not allowed
(and if ?: is allowed, it must go down each of its branches to determine
if they have something banned).
Anyhow, a backend strength-reducer would not be so constrained.
(hey, can we start using the terms 'strength reducer' and 'constant
evaluator' to distinguish the two uses that are currently tangled up
Does that answer your question?
Thanks for your explanation of gimple folding etc, it was most
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
email@example.com :: http://www.planetfall.pwp.blueyonder.co.uk