This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/29739] -Wconversion produces invalid warnings.
- From: "lopezibanez at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Nov 2006 16:30:16 -0000
- Subject: [Bug c/29739] -Wconversion produces invalid warnings.
- References: <bug-29739-10172@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from lopezibanez at gmail dot com 2006-11-06 16:30 -------
(a bit more explanation won't hurt)
The GCC documentation says:
-Wconversion: Warn if a prototype causes a type conversion that is different
from what would happen to the same argument in the absence of a prototype.
In your program, in the absence of prototype, d would be promoted to int, thus
the warning is correct. Wconversion is only useful for translating very old C
code to ANSI/ISO C.
Since this behaviour is not very useful in the present day, and Wconversion
also warns for unsigned i = -1, we are going to move the above behaviour to
Wtraditional-conversion and make Wconversion warn for implicit conversions that
may change a value. This is planned for GCC 4.3 .
For more info, please check http://gcc.gnu.org/wiki/Wcoercion and don't
hesitate to contact me. (That wiki page is work in progress, not definitive,
actually, it is a bit outdated). Testing and comments are welcome.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29739