<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Volatile Structs Are Broken</title>
	<atom:link href="http://blog.regehr.org/archives/274/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.regehr.org/archives/274</link>
	<description></description>
	<lastBuildDate>Thu, 23 May 2013 02:13:55 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: regehr</title>
		<link>http://blog.regehr.org/archives/274/comment-page-1#comment-1337</link>
		<dc:creator>regehr</dc:creator>
		<pubDate>Thu, 07 Oct 2010 06:27:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.regehr.org/?p=274#comment-1337</guid>
		<description><![CDATA[Hi Xilun-  Yes, what constitutes an access to a volatile variable is implementation defined.  But you have missed the fact that all reasonable C implementations consider a read from a volatile variable to be a read access and a write to a volatile variable to be a write access. We discussed this in some detail in the EMSOFT paper linked from the post.

This is a real bug.  As I noted in an update, it was fixed in LLVM within hours of being reported.  I expect that it will get fixed in GCC as well.]]></description>
		<content:encoded><![CDATA[<p>Hi Xilun-  Yes, what constitutes an access to a volatile variable is implementation defined.  But you have missed the fact that all reasonable C implementations consider a read from a volatile variable to be a read access and a write to a volatile variable to be a write access. We discussed this in some detail in the EMSOFT paper linked from the post.</p>
<p>This is a real bug.  As I noted in an update, it was fixed in LLVM within hours of being reported.  I expect that it will get fixed in GCC as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: xilun</title>
		<link>http://blog.regehr.org/archives/274/comment-page-1#comment-1334</link>
		<dc:creator>xilun</dc:creator>
		<pubDate>Wed, 06 Oct 2010 22:37:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.regehr.org/?p=274#comment-1334</guid>
		<description><![CDATA[Maybe this was different with C90 but C99 indeed does not seem to mandate generation of assembly instructions reading then storing back g_18: &quot;6.7.3 Type qualifiers [...] What constitutes an access to an object that has volatile-qualified type is implementation-defined.&quot;

So while IMO g_18.f0 = g_18.f0 * 2; should clearly generate load, mul, then store instructions, implementing func1() as a nop seem to be compliant with both 5.1.2.3 and 6.7.3. This is also consistent with the only clear requirement for volatiles: to be usable for signalisation between signals handlers and the rest of the program.

(Even though a note in C99 says that volatile &quot;may be used to describe an object corresponding to a memory-mapped input/output port&quot;, this obviously can only happen on systems where all bus access are strongly ordered throughout every hardware layer, otherwise the order of instructions generated by gcc would be meaningless in regard with what happen on the bus -- and this is not the case for x86, and now more and more rare even on embedded systems.)

So maybe the only question that remains is: does &quot;rep ret&quot; executes as &quot;ret&quot; (and does so on all targeted x86 cpus). If this is not the case, this clearly is a bug. Otherwise, probably not.]]></description>
		<content:encoded><![CDATA[<p>Maybe this was different with C90 but C99 indeed does not seem to mandate generation of assembly instructions reading then storing back g_18: &#8220;6.7.3 Type qualifiers [...] What constitutes an access to an object that has volatile-qualified type is implementation-defined.&#8221;</p>
<p>So while IMO g_18.f0 = g_18.f0 * 2; should clearly generate load, mul, then store instructions, implementing func1() as a nop seem to be compliant with both 5.1.2.3 and 6.7.3. This is also consistent with the only clear requirement for volatiles: to be usable for signalisation between signals handlers and the rest of the program.</p>
<p>(Even though a note in C99 says that volatile &#8220;may be used to describe an object corresponding to a memory-mapped input/output port&#8221;, this obviously can only happen on systems where all bus access are strongly ordered throughout every hardware layer, otherwise the order of instructions generated by gcc would be meaningless in regard with what happen on the bus &#8212; and this is not the case for x86, and now more and more rare even on embedded systems.)</p>
<p>So maybe the only question that remains is: does &#8220;rep ret&#8221; executes as &#8220;ret&#8221; (and does so on all targeted x86 cpus). If this is not the case, this clearly is a bug. Otherwise, probably not.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
