RFD: Should __builtin_constant_p approximate CONSTANT_P ?
Andi Kleen
andi@firstfloor.org
Tue Apr 23 14:18:00 GMT 2013
Joern Rennecke <joern.rennecke@embecosm.com> writes:
>
> More importantly. addresses that becomes a SYMBOL_REF should be considered
> constant. I.e. In particular, the addresses of variables with static storage.
> I have a simple patch to recognize these as constants;
> do people agree that this is the right thing to do?
if someone writes
if (__builtin_constant_p(x) && x == 1) ... and assume the compiler can
collapse at compile time then a SYMBOL_REF wouldn't DTRT.
I've seen quite a bit such code. So I would prefer to accept only numbers known
at compile time already.
-Andi
--
ak@linux.intel.com -- Speaking for myself only
More information about the Gcc
mailing list