public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/50347] New: unexpected -Wconversion error from gcc builtin
@ 2011-09-10 8:45 gcc.hall at gmail dot com
2011-09-10 10:19 ` [Bug c/50347] " gcc.hall at gmail dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: gcc.hall at gmail dot com @ 2011-09-10 8:45 UTC (permalink / raw)
To: gcc-bugs
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: unassigned@gcc.gnu.org
ReportedBy: gcc.hall@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)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/50347] unexpected -Wconversion error from gcc builtin
2011-09-10 8:45 [Bug c/50347] New: unexpected -Wconversion error from gcc builtin gcc.hall at gmail dot com
@ 2011-09-10 10:19 ` gcc.hall at gmail dot com
2011-09-11 0:38 ` gcc.hall at gmail dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: gcc.hall at gmail dot com @ 2011-09-10 10:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50347
--- Comment #1 from Jeremy <gcc.hall at gmail dot com> 2011-09-10 10:15:15 UTC ---
I see this builtin is presumably intended to implement the library function
ffsll() which takes a signed argument. In which case this is just a
documentation issue.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/50347] unexpected -Wconversion error from gcc builtin
2011-09-10 8:45 [Bug c/50347] New: unexpected -Wconversion error from gcc builtin gcc.hall at gmail dot com
2011-09-10 10:19 ` [Bug c/50347] " gcc.hall at gmail dot com
@ 2011-09-11 0:38 ` gcc.hall at gmail dot com
2012-06-07 14:02 ` manu at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: gcc.hall at gmail dot com @ 2011-09-11 0:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50347
--- Comment #2 from Jeremy <gcc.hall at gmail dot com> 2011-09-10 21:57:59 UTC ---
I think also the doc needs changing for __builtin_bswap64/32 as it looks like
they accept and return unsigned integers. uint64_t instead of int64_t.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/50347] unexpected -Wconversion error from gcc builtin
2011-09-10 8:45 [Bug c/50347] New: unexpected -Wconversion error from gcc builtin gcc.hall at gmail dot com
2011-09-10 10:19 ` [Bug c/50347] " gcc.hall at gmail dot com
2011-09-11 0:38 ` gcc.hall at gmail dot com
@ 2012-06-07 14:02 ` manu at gcc dot gnu.org
2014-03-25 20:53 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: manu at gcc dot gnu.org @ 2012-06-07 14:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50347
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu.org
--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-06-07 14:02:12 UTC ---
Could you send a doc patch to gcc-patches@ ? Thanks!
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/50347] unexpected -Wconversion error from gcc builtin
2011-09-10 8:45 [Bug c/50347] New: unexpected -Wconversion error from gcc builtin gcc.hall at gmail dot com
` (2 preceding siblings ...)
2012-06-07 14:02 ` manu at gcc dot gnu.org
@ 2014-03-25 20:53 ` mpolacek at gcc dot gnu.org
2014-03-27 15:59 ` mpolacek at gcc dot gnu.org
2014-03-27 15:59 ` mpolacek at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-03-25 20:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50347
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |documentation
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2014-03-25
CC| |mpolacek at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
__builtin_bswap* were fixed in r191774. I have a patch for ffs* builtins.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/50347] unexpected -Wconversion error from gcc builtin
2011-09-10 8:45 [Bug c/50347] New: unexpected -Wconversion error from gcc builtin gcc.hall at gmail dot com
` (3 preceding siblings ...)
2014-03-25 20:53 ` mpolacek at gcc dot gnu.org
@ 2014-03-27 15:59 ` mpolacek at gcc dot gnu.org
2014-03-27 15:59 ` mpolacek at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-03-27 15:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50347
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/50347] unexpected -Wconversion error from gcc builtin
2011-09-10 8:45 [Bug c/50347] New: unexpected -Wconversion error from gcc builtin gcc.hall at gmail dot com
` (4 preceding siblings ...)
2014-03-27 15:59 ` mpolacek at gcc dot gnu.org
@ 2014-03-27 15:59 ` mpolacek at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-03-27 15:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50347
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Thu Mar 27 15:59:07 2014
New Revision: 208870
URL: http://gcc.gnu.org/viewcvs?rev=208870&root=gcc&view=rev
Log:
PR c/50347
* doc/extend.texi (ffs Builtins): Change unsigned types to signed
types.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/doc/extend.texi
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-03-27 15:59 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-10 8:45 [Bug c/50347] New: unexpected -Wconversion error from gcc builtin gcc.hall at gmail dot com
2011-09-10 10:19 ` [Bug c/50347] " gcc.hall at gmail dot com
2011-09-11 0:38 ` gcc.hall at gmail dot com
2012-06-07 14:02 ` manu at gcc dot gnu.org
2014-03-25 20:53 ` mpolacek at gcc dot gnu.org
2014-03-27 15:59 ` mpolacek at gcc dot gnu.org
2014-03-27 15:59 ` mpolacek at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).