This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/38789] [4.4 Regression] __builtin_constant_p appears to eveluate to true for non-constant arguments.



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]