This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c/6614: [-Wconversion] incorrect conversion warning for function taking a short
- From: bangerth at dealii dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, josh dot dybnis at sandtechnology dot com, nobody at gcc dot gnu dot org
- Date: 5 Nov 2002 16:42:43 -0000
- Subject: Re: c/6614: [-Wconversion] incorrect conversion warning for function taking a short
- Reply-to: bangerth at dealii dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, josh dot dybnis at sandtechnology dot com, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Old Synopsis: incorrect conversion warning for function taking a short
New Synopsis: [-Wconversion] incorrect conversion warning for function taking a short
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Tue Nov 5 08:42:43 2002
State-Changed-Why:
Yes, this is odd. In some way the compiler is right, since
if no prototype were present, the short would be converted
to an int. Here, there is a prototype, so the conversion
does not take place. Thus, something different is happening,
which is exactly what the documentation of -Wconversion says
is what it is all about. However, in this case it is clearly
odd to get a message.
Testcase:
--------------------------------------
tmp/g> cat x.c
void func (short);
void short_test (void)
{ short x = 0;
func(x);
}
tmp/g> /home/bangerth/bin/gcc-3.2.1-pre/bin/gcc -Wconversion -c x.c
x.c: In function `short_test':
x.c:4: warning: passing arg 1 of `func' with different width due to prototype
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6614