public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* __builtin_constant_p not evalutating to a constant
@ 2005-01-14 17:21 Erich Plondke
0 siblings, 0 replies; only message in thread
From: Erich Plondke @ 2005-01-14 17:21 UTC (permalink / raw)
To: gcc-bugs
Hello!
There was a similar question to this on the mailing list archives, but
I could not
find the answer.
I would like to combine __builtin_choose_expr with __builtin_constant_p, in
something like this:
#define SHIFTLEFT(a,b) __builtin_choose_expr(__builtin_constant_p(b), \
((a) << (b)), \
((a) << (MIN(31,MAX(-31,(b)))))
I could use this to determine whether I need special behavoir, because I might
be able to assume that constants were never in some "bad range" of values.
Unfortunately, when I try this, I get:
file.c:42 error: first argument to __builtin_choose_expr not a constant
However, according to the documentation, __builtin_constant_p should
return 0 if the compiler cannot prove that the argument expression
is a constant. One would expect that 0 is a constant, and that it should
always be a valid first argument to __builtin_choose_expr.
Am I doing something wrong? Perhaps we could have
__builtin_constant_constant_p() that would be a valid constant always?
Thanks!
Erich
--
Why are ``tolerant'' people so intolerant of intolerant people?
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-01-14 17:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-14 17:21 __builtin_constant_p not evalutating to a constant Erich Plondke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).