http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50347
Bug #: 50347 Summary: unexpected -Wconversion error from gcc builtin Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: gcc.h...@gmail.com This message is produced from the code example below. bug.c: In function 'main': bug.c:17:2: warning: conversion to 'long long int' from 'long long unsigned int' may change the sign of the result [-Wsign-conversion] builtin_ffsll is documented as:- Built-in Function: int __builtin_ffsll (unsigned long long) Similar to __builtin_ffs, except the argument type is unsigned long long. Note this does not happen with the other similar builtin's (__ctzll for example) ----------------------------------------------------------------- #include <stdio.h> #include <stdlib.h> int main( int argc, char *argv[] ) { if( argc > 1 ) { char *tail; unsigned long long n = strtoull( argv[1], &tail, 0 ); if( tail == argv[1] ) return 1; int lsb = __builtin_ffsll( n ); printf("lsb = %d\n", lsb ); } return 0; } ------------------------------------------------------------------- * gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i686-pc-linux-gnu/4.6.1/lto-wrapper Target: i686-pc-linux-gnu Configured with: ../gcc-4.6.1/configure Thread model: posix gcc version 4.6.1 (GCC)