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 c/52708] suboptimal code with __builtin_constant_p


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52708

--- Comment #1 from Tijl Coosemans <tijl at coosemans dot org> 2012-03-25 20:09:34 UTC ---
(In reply to comment #0)
> Consider the following code:
> 
> --------------------
> #include <stdio.h>
> 
> int bar(void) __attribute__((__const__));
> 
> int main( int argc, char **argv ) {
>     int res;
> 
>     res = (__builtin_constant_p(bar()) ? 0 : 1);
>     printf( "%d\n", res );
> 
>     res = (__builtin_constant_p(bar()) ? 0 : bar());
>     printf( "%d\n", res );
> 
>     return(0);
> }
> --------------------

"bar" should have been "foo" here, to match the surrounding text.


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