This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: -Wconversion producing incorrect warning
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: "Kevin P. Fleming" <kpfleming at starnetworks dot us>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 4 Nov 2005 12:21:00 +0100
- Subject: Re: -Wconversion producing incorrect warning
- References: <43665412.3040900@starnetworks.us>
using GCC 3.3.5, 3.4.3 and 4.0.1 with '-Wconversion' in effect, I get
this warning:
luigi.c: In function `main':
luigi.c:15: warning: passing arg 1 of `f' with different width due to
prototype
I don't understand why this is true... the prototype and the argument
are of the same type.
Yes, so the parameter will be passed as whatever your ABI
specifies for parameters of unsigned 16-bit type.
The problem here is, that -Wconversion does _not_ warn
about type conversions in your code! It is a warning for
people trying to port old K&R C code to ANSI C. What the
warning means is, "if there would not have been a prototype
for f() in scope, the parameter would have been passed as
a 32-bit type".
GCC does not currently have a warning with the behaviour
you might have expected, and the name of "-Wconversion"
confuses a lot of people. Perhaps we should change its
name...
Segher