[Bug tree-optimization/38789] [4.4 Regression] __builtin_constant_p appears to evaluate to true for non-constant arguments.
jakub at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Jan 16 12:43:00 GMT 2009
------- Comment #7 from jakub at gcc dot gnu dot org 2009-01-16 12:42 -------
The correct testcase is IMHO:
void
baz (int v)
{
unsigned a = (v == 1) ? 1 : 2;
if (__builtin_constant_p (a))
asm volatile ("# constant %0" :: "i" (a));
else
asm volatile ("# register %0" :: "r" (a));
}
For non-constant a using "i" constraint is wrong. This fails since
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134833
I guess handling BUILT_IN_CONSTANT_P the same as BUILT_IN_OBJECT_SIZE in
record_temporary_equivalences_from_stmts_at_dest
could do the trick.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38789
More information about the Gcc-bugs
mailing list