-Wconversion not right (<32 bit problem)

J. Kean Johnston jkj@sco.com
Thu Oct 2 18:48:00 GMT 1997


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





More information about the Gcc mailing list