Red Hat Bugzilla – Bug 127606
__builtin_expect's prototype does not expect int args; assert feeds it just that
Last modified: 2007-11-30 17:10:45 EST
Description of problem: gcc -Wconversion will always complain about invocations of the assert macro. Apparently a boolean expression (i.e. of type int) is not accepted by __builtin_expect, which is called by the assert macro. Version-Release number of selected component (if applicable): gcc-3.3.3-7 (for AMD 64) How reproducible: Always. Steps to Reproduce: 1. cat >t.c <<\EOF #include <assert.h> int main() { assert(1); assert(1L); assert(1LL); assert(&main); return 0; } EOF 2.gcc -Wconversion t.c Actual results: t.c: In function `main': t.c:6: warning: passing arg 1 of `__builtin_expect' with different width due to prototype t.c:6: warning: passing arg 2 of `__builtin_expect' with different width due to prototype t.c:7: warning: passing arg 1 of `__builtin_expect' with different width due to prototype t.c:7: warning: passing arg 2 of `__builtin_expect' with different width due to prototype t.c:8: warning: passing arg 1 of `__builtin_expect' with different width due to prototype t.c:8: warning: passing arg 2 of `__builtin_expect' with different width due to prototype t.c:9: warning: passing arg 1 of `__builtin_expect' with different width due to prototype t.c:9: warning: passing arg 2 of `__builtin_expect' with different width due to pro Expected results: [silence, certainly for line 6, but probably for the others as well] Additional info: After preprocessing, the first assert becomes: ((void) (__builtin_expect (!!(1), 1) ? 0 : (__assert_fail ("1", "t.c", 6, __PRETTY_FUNCTION__), 0))); There is nothing suspicious about the arguments to __builtin_expect. This might be related to <https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=103017>
I've removed __builtin_expect from the upstream glibc. The result will be in FC3 rawhide soon.
The patch is in glibc-2.3.2-95.28 which ought to appear in U4 beta.
An errata has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2004-586.html