Bug 127606 - __builtin_expect's prototype does not expect int args; assert feeds it just that
__builtin_expect's prototype does not expect int args; assert feeds it just that
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
2
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-07-10 15:53 EDT by D. Hugh Redelmeier
Modified: 2007-11-30 17:10 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-04 03:42:44 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description D. Hugh Redelmeier 2004-07-10 15:53:59 EDT
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>
Comment 1 Ulrich Drepper 2004-10-04 03:42:44 EDT
I've removed __builtin_expect from the upstream glibc.  The result
will be in FC3 rawhide soon.
Comment 2 Jakub Jelinek 2004-10-06 14:32:42 EDT
The patch is in glibc-2.3.2-95.28 which ought to appear in U4 beta.
Comment 3 John Flanagan 2004-12-20 13:14:13 EST
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

Note You need to log in before you can comment on or make changes to this bug.