implicit narrowing conversion.

Joseph S. Myers jsm@polyomino.org.uk
Wed Jun 23 14:23:00 GMT 2004


On Tue, 22 Jun 2004, Adam Sulmicki wrote:

> shouldn't this code below generate warnings on "implicit narrowing
> conversion", on:
> 	1) "i=f" assignment as well as
> 	2) on conversion on return from float to int?

The desire for a better -Wconversion has been known for years.  I have a
notional specification for it, "warn for any implicit conversion that may
change a value", as discussed at
<http://www.srcf.ucam.org/~jsm28/gcc/#Wconversion>, arising from a
discussion on security-audit (there having been a spate of security
problems relating to implicit signed/unsigned conversions)
<http://archives.neohapsis.com/archives/linux/lsap/2000-q4/0153.html>, and
also discussed in bug 6614 and elsewhere.  There are far more features
that would be nice to have than there is implementation time, and so far
no-one has contributed an implementation of this one.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)



More information about the Gcc mailing list