[Bug c/38116] New: Excessive warnings when using assert and -Wconversion on 64bit platforms

paulf at free dot fr gcc-bugzilla@gcc.gnu.org
Fri Nov 14 14:17:00 GMT 2008


/* foo.c */
#include <assert.h>

void foo(void)
{
   assert(1);
}

gcc -c -Wconversion foo.c
foo.c:6: warning: passing argument 1 of '__builtin_expect' with different width
due to prototype
foo.c:6: warning: passing argument 2 of '__builtin_expect' with different width
due to prototype

This is because assert() boils down to
__builtin_expect (!!(expr), 1), which means that __builtin_expect is called
with two int arguments. However, the signature of __builtin_expect is

long int __builtin_expect (long int exp, long int val)

Hence two warnings for the conversion of int to long int.

This greatly limits the usefulness of -Wconversion.


-- 
           Summary: Excessive warnings when using assert and -Wconversion on
                    64bit platforms
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: paulf at free dot fr


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



More information about the Gcc-bugs mailing list