<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/1.5.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Signed Overflow</title>
	<link>http://www.airs.com/blog/archives/120</link>
	<description>Ian Lance Taylor</description>
	<pubDate>Fri, 25 Jul 2008 10:50:11 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5.2</generator>

	<item>
 		<title>Comment on Signed Overflow by: Ian Lance Taylor</title>
		<link>http://www.airs.com/blog/archives/120#comment-9322</link>
		<pubDate>Fri, 11 Jan 2008 15:36:37 +0000</pubDate>
		<guid>http://www.airs.com/blog/archives/120#comment-9322</guid>
					<description>There is no warning about the last example from gcc mainline because gcc doesn't actually optimize it differently based on undefined signed overflow.  It just goes ahead and generated the overflow code.  I wasn't clear: I didn't intend that to be an example of using overflow to optimize, I intended to show a case where -fwrapv differed from -fno-strict-overflow.</description>
		<content:encoded><![CDATA[	<p>There is no warning about the last example from gcc mainline because gcc doesn&#8217;t actually optimize it differently based on undefined signed overflow.  It just goes ahead and generated the overflow code.  I wasn&#8217;t clear: I didn&#8217;t intend that to be an example of using overflow to optimize, I intended to show a case where -fwrapv differed from -fno-strict-overflow.
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Signed Overflow by: ncm</title>
		<link>http://www.airs.com/blog/archives/120#comment-9310</link>
		<pubDate>Thu, 10 Jan 2008 22:53:21 +0000</pubDate>
		<guid>http://www.airs.com/blog/archives/120#comment-9310</guid>
					<description>I see what happened:

$ gcc -O3 -Wstrict-overflow=5 -Wall -c t.c

is not the same as

$ gcc -O3 -Wall -Wstrict-overflow=5 -c t.c

Evidently the -Wall in the first example bumps the warning level back down to 1.  I see that gcc-4.2 warns only about the first example, I suppose because it doesn't perform that optimization on the next two.  I can't seem to get a warning about the last example from gcc-4.3.  Shouldn't I?  It looks like bad code.</description>
		<content:encoded><![CDATA[	<p>I see what happened:</p>
	<p>$ gcc -O3 -Wstrict-overflow=5 -Wall -c t.c</p>
	<p>is not the same as</p>
	<p>$ gcc -O3 -Wall -Wstrict-overflow=5 -c t.c</p>
	<p>Evidently the -Wall in the first example bumps the warning level back down to 1.  I see that gcc-4.2 warns only about the first example, I suppose because it doesn&#8217;t perform that optimization on the next two.  I can&#8217;t seem to get a warning about the last example from gcc-4.3.  Shouldn&#8217;t I?  It looks like bad code.
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Signed Overflow by: Ian Lance Taylor</title>
		<link>http://www.airs.com/blog/archives/120#comment-9307</link>
		<pubDate>Thu, 10 Jan 2008 18:21:06 +0000</pubDate>
		<guid>http://www.airs.com/blog/archives/120#comment-9307</guid>
					<description>I think the full effects only come in on gcc mainline.  At least, gcc 4.2 does not eliminate the loop, but gcc 4.3 will.  All my examples were run with gcc mainline.</description>
		<content:encoded><![CDATA[	<p>I think the full effects only come in on gcc mainline.  At least, gcc 4.2 does not eliminate the loop, but gcc 4.3 will.  All my examples were run with gcc mainline.
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Signed Overflow by: ncm</title>
		<link>http://www.airs.com/blog/archives/120#comment-9297</link>
		<pubDate>Thu, 10 Jan 2008 03:13:10 +0000</pubDate>
		<guid>http://www.airs.com/blog/archives/120#comment-9297</guid>
					<description>I'm running 

$ gcc --version

gcc (GCC) 4.2.3 20080102 (prerelease) (Debian 4.2.2-5)

and putting all your code examples into t.c and compiling with

$ gcc -O3 -Wstrict-overflow=5 -fstrict-overflow -Wall -W -c t.c

I get no warnings at all.  Should I be surprised at this?</description>
		<content:encoded><![CDATA[	<p>I&#8217;m running </p>
	<p>$ gcc &#8211;version</p>
	<p>gcc (GCC) 4.2.3 20080102 (prerelease) (Debian 4.2.2-5)</p>
	<p>and putting all your code examples into t.c and compiling with</p>
	<p>$ gcc -O3 -Wstrict-overflow=5 -fstrict-overflow -Wall -W -c t.c</p>
	<p>I get no warnings at all.  Should I be surprised at this?
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Signed Overflow by: Ian Lance Taylor</title>
		<link>http://www.airs.com/blog/archives/120#comment-9294</link>
		<pubDate>Thu, 10 Jan 2008 02:28:25 +0000</pubDate>
		<guid>http://www.airs.com/blog/archives/120#comment-9294</guid>
					<description>-Wstrict-overflow should issue a warning if you compile with -O2.  -Wstrict-overflow warns about cases where an optimization relies on undefined overflow; it doesn't have any way to detect possible overflow except when an optimization is applied.  In some cases you will need to use -Wstrict-overflow=5.

-Wall includes -Wstrict-overflow=1.  Specifying -Wstrict-overflow with no number is equivalent to -Wstrict-overflow=2.

The docs are available at http://gcc.gnu.org/onlinedocs/ .</description>
		<content:encoded><![CDATA[	<p>-Wstrict-overflow should issue a warning if you compile with -O2.  -Wstrict-overflow warns about cases where an optimization relies on undefined overflow; it doesn&#8217;t have any way to detect possible overflow except when an optimization is applied.  In some cases you will need to use -Wstrict-overflow=5.</p>
	<p>-Wall includes -Wstrict-overflow=1.  Specifying -Wstrict-overflow with no number is equivalent to -Wstrict-overflow=2.</p>
	<p>The docs are available at <a href='http://gcc.gnu.org/onlinedocs/' rel='nofollow'>http://gcc.gnu.org/onlinedocs/</a> .
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Signed Overflow by: ncm</title>
		<link>http://www.airs.com/blog/archives/120#comment-9291</link>
		<pubDate>Wed, 09 Jan 2008 22:08:18 +0000</pubDate>
		<guid>http://www.airs.com/blog/archives/120#comment-9291</guid>
					<description>I see that -Wstrict-overflow is accepted by Debian's gcc-4.2.3.  However, it issues no warnings for the code examples presented.

Is it included in -W or -Wall?  (Debian has not packaged gcc-4.2 docs yet.)</description>
		<content:encoded><![CDATA[	<p>I see that -Wstrict-overflow is accepted by Debian&#8217;s gcc-4.2.3.  However, it issues no warnings for the code examples presented.</p>
	<p>Is it included in -W or -Wall?  (Debian has not packaged gcc-4.2 docs yet.)
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
