This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/38789] [4.4 Regression] __builtin_constant_p appears to eveluate to true for non-constant arguments.
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jan 2009 21:56:52 -0000
- Subject: [Bug tree-optimization/38789] [4.4 Regression] __builtin_constant_p appears to eveluate to true for non-constant arguments.
- References: <bug-38789-7151@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from pinskia at gcc dot gnu dot org 2009-01-09 21:56 -------
(In reply to comment #2)
> where the code is duplicated twice and both cases are constant.
Except it is not duplicated in jump threading. It would have been ok if it did
but it does not ...
Jump threading proved probability of edge 4->5 too small (it is 1528, should be
10000).
Threaded jump 3 --> 4 to 4
Threaded jump 2 --> 4 to 4
Pass statistics:
----------------
Jumps threaded: 2
void bar(int v)
{
unsigned a;
a = 0;
if (v == 2)
a = 1;
if (__builtin_constant_p(a)) {
asm volatile ("you lose. %0" : : "ir" (a));
} else {
asm volatile ("you win. %0" : : "ir" (a));
}
}
is another example.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38789