--- Comment #2 from rguenth at gcc dot gnu dot org 2009-01-09 21:51 ---
I wouldn't consider this a bug. It's similar to
inline void foo(int i) { if (__builtin_constant_p (i)) you_loose(); }
void bar()
{
foo (1);
foo (2);
}
where the code is duplicated twice and both cases are
--- Comment #3 from daney at gcc dot gnu dot org 2009-01-09 21:55 ---
Good, this code comes from the Linux kernel:
mm/backing-dev.c (set_bdi_congested())
Is the kernel at fault? If so I am sure Linus would like to hear about it.
--
--- 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
--- Comment #5 from daney at gcc dot gnu dot org 2009-01-09 22:00 ---
You have to be able to do one of the original test case or this:
$ cat foo1.c
void baz(int v)
{
unsigned a;
a = (v == 1) ? 1 : 2;
if (__builtin_constant_p(a)) {
asm volatile
--- Comment #6 from rguenth at gcc dot gnu dot org 2009-01-09 22:57 ---
Ok, I'm convinced. That jump-threading is really weird. But only because
__builtin_constant_p isn't a regular function that is executed on a path
of the CFG, it really is supposed to be evaluating all paths
--
rguenth at gcc dot gnu dot org changed:
What|Removed |Added
Summary|[4.4 Regression]|[4.4 Regression]
|__builtin_constant_p