This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

-Wconversion not right (<32 bit problem)


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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]