This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/16378] New: incorrect warning "with different width" with -O2 -Wconversion
- From: "pepster at users dot sourceforge dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Jul 2004 05:07:22 -0000
- Subject: [Bug c/16378] New: incorrect warning "with different width" with -O2 -Wconversion
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
C code (relevant part from from include/glib-2.0/glib/gstring.h)
---------------------------------------------------------------------------
typedef unsigned char gchar;
typedef int gsize;
typedef int gssize;
typedef struct _GString GString;
struct _GString
{
gchar *str;
gsize len;
gsize allocated_len;
};
GString* g_string_insert_c (GString *string,
gssize pos,
gchar c);
static inline GString*
g_string_append_c_inline (GString *gstring,
gchar c)
{
g_string_insert_c(gstring, -1, c);
return gstring;
}
----------------------------------------------------------
gcc -v -c -O2 -Wconversion cc.c
Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.1/specs
Configured with: ../gcc-3.4.1/configure --enable-languages=c,c++
Thread model: posix
gcc version 3.4.1
/usr/local/libexec/gcc/i686-pc-linux-gnu/3.4.1/cc1 -quiet -v cc.c -quiet
-dumpbase cc.c -mtune=pentiumpro -auxbase cc -O2 -Wconversion -version -o
/tmp/ccKwK1vr.s
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory
"/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.1/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.1/include
/usr/include
End of search list.
GNU C version 3.4.1 (i686-pc-linux-gnu)
compiled by GNU C version 3.4.1.
GGC heuristics: --param ggc-min-expand=80 --param ggc-min-heapsize=94545
cc.c: In function `g_string_append_c_inline':
cc.c:22: warning: passing arg 3 of `g_string_insert_c' with different width due
to prototype
as -V -Qy -o cc.o /tmp/ccKwK1vr.s
GNU assembler version 2.13.90.0.2 (i386-redhat-linux) using BFD version
2.13.90.0.2 20020802
uname -a
Linux yoda 2.4.20-30.8.legacy #1 Fri Feb 20 18:58:10 PST 2004 i686 athlon i386
GNU/Linux
--
Summary: incorrect warning "with different width" with -O2 -
Wconversion
Product: gcc
Version: 3.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pepster at users dot sourceforge dot net
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16378