<?xml version="1.0" encoding="UTF-8" standalone="yes"?><oembed><version><![CDATA[1.0]]></version><provider_name><![CDATA[Software is Crap]]></provider_name><provider_url><![CDATA[https://davmac.wordpress.com]]></provider_url><author_name><![CDATA[davmac]]></author_name><author_url><![CDATA[https://davmac.wordpress.com/author/davmac/]]></author_url><title><![CDATA[Mesa and strict&nbsp;aliasing]]></title><type><![CDATA[link]]></type><html><![CDATA[<p>I recently started poking at the <a href="http://mesa3d.org/">Mesa</a> source code. Presently Mesa builds with &#8220;-fno-strict-aliasing&#8221; by default, and removing that option produces a non-working binary. I started looking into this and just recently have submitted (the second version of) a patch to address some of the aliasing problems &#8211; enough that I could build a working binary with <a href="http://stackoverflow.com/questions/98650/what-is-the-strict-aliasing-rule">strict aliasing</a> enabled:</p>
<p style="padding-left:30px;"><a href="http://lists.freedesktop.org/archives/mesa-dev/2015-June/087278.html">http://lists.freedesktop.org/archives/mesa-dev/2015-June/087278.html</a></p>
<p>I don&#8217;t know whether this will be taken on board; at the time of writing, no-one has formally reviewed it or agreed to push it upstream. The performance improvement when compiling with vs without <em>-fno-strict-aliasing is</em>, admittedly, a bit underwhelming (less than I had hoped for, anyway); however, I personally feel that code requiring strict aliasing to be turned off is broken anyway.</p>
<p>Not everyone thinks that way, though. It&#8217;s clear that Ian Romanick, a prominent Mesa developer, <a href="http://lists.freedesktop.org/archives/mesa-dev/2015-June/087190.html">did not (originally) even understand the issue</a>:</p>
<blockquote><p>NAK.  The datastructure is correct as-is.  It has been in common use since at least 1985.  See the references in the header file.</p></blockquote>
<p>(The data structure is indeed correct; the implementation is broken unless strict aliasing is disabled). I don&#8217;t think it&#8217;s uncommon that C developers don&#8217;t properly understand the aliasing rules, but that&#8217;s a shame. The rules aren&#8217;t really that complicated. I liked this quote from Dave Airlie, another Mesa developer:</p>
<blockquote><p>I personally think we should get past the, aliasing is hard, lets go shopping,</p></blockquote>
<p>Or in other words: let&#8217;s stop using -fno-strict-aliasing as a crutch and just fix the problems. I&#8217;m glad that I&#8217;m not the only one with this opinion. A few other developers, however, clearly feel that it is too difficult, and that <em>-fno-strict-aliasing</em> is the answer. It&#8217;ll be interesting to see how this plays out.</p>
]]></html></oembed>