RFD: Should __builtin_constant_p approximate CONSTANT_P ?

Joern Rennecke joern.rennecke@embecosm.com
Tue Apr 23 14:32:00 GMT 2013


Quoting Andi Kleen <andi@firstfloor.org>:

> if (__builtin_constant_p(x) && x == 1) ... and assume the compiler can
> collapse at compile time then a SYMBOL_REF wouldn't DTRT.

Unless you set x to the address of a variable / function and this is
constant-propagated, x will not become a SYMBOL_REF.
If x is a variable with static storage, it will be a MEM (symbol_ref).
&x will be a SYMBOL_REF.



More information about the Gcc mailing list