This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
-Wconversion not right (<32 bit problem)
- To: EGCS Mailing List <egcs at cygnus dot com>, GCC2 Mailing List <gcc2 at cygnus dot com>
- Subject: -Wconversion not right (<32 bit problem)
- From: "J. Kean Johnston" <jkj at sco dot com>
- Date: Thu, 2 Oct 1997 18:49:20 -0700 (PDT)
Hi all.
In both GCC2 and egcs, this simple (and to my eyes valid) case produces
the warning:
bw.c: In function `test':
bw.c:13: warning: passing arg 1 of `foo' with different width due to prototype
<snip>
typedef unsigned short u_short;
extern u_short foo(u_short);
extern void test(void);
u_short foo(u_short bar) {
return bar;
}
void test(void)
{
u_short x,y=0;
x = foo(y);
}
<snip>
This is wrong. The function is declared to take a u_short, and a u_short
is passed. The same warning is emitted for u_char too. It seems to be for
any entity < 32 bits. Does this imply that even though I am passing a
16 bit quantity, a 32-bit quantity is pushed on the stack? If so this is
BAD news.
JKJ