<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-family: Arial, sans-serif; ">
<div>
<div>
<div style="font-size: 13px; ">Here's a code generated with <b>-Os</b> on darwin/x86_64 with clang from the Xcode 4.2 GM toolset on Mac OSX 10.7.2 (Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn), Target: x86_64-apple-darwin11.2.0)</div>
<div style="font-size: 13px; "><br>
</div>
<div style="font-size: 13px; ">
<div>0x000000010277d281  <+2102>  lea    0x1d43bd0(%rip),%rax        # 0x1044c0e58 <gFloorPlanCutData></div>
<div>0x000000010277d288  <+2109>  movaps 0x80(%rax),%xmm0</div>
<div>0x000000010277d28f  <+2116>  movaps %xmm0,-0x40(%rbp)</div>
</div>
<div style="font-size: 13px; "><br>
</div>
<div style="font-size: 13px; "><br>
</div>
<div style="font-size: 13px; ">The documentation for 'movaps' states: "<span class="Apple-style-span" style="font-size: medium; font-family: Arial; ">When the source or destination operand is a memory location, it must be aligned on a 16-byte boundary.</span>"
 The problem is that the address of the global variable loaded into AX is not necessarily aligned; as it isn't in our case, which leads to the crash.</div>
<div style="font-size: 13px; "><br>
</div>
<div style="font-size: 13px; ">Here's is the code; it is loading the address of a global variable into AX, and tries to copy the data member, coming from the following class:</div>
<div style="font-size: 13px; "><br>
</div>
<div style="font-size: 13px; ">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo">MD5::FingerPrint<span class="Apple-tab-span" style="white-space:pre">
</span>cutDataCheckSum = ::gFloorPlanCutData.GetCutDataCheckSum ();</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo">memcpy (elemData->cutDataCheckSum, cutDataCheckSum.data,
<span style="color: #bb2d9d">sizeof</span> (elemData->cutDataCheckSum));</p>
</div>
<div style="font-size: 13px; "><br>
</div>
<div style="font-size: 13px; "><br>
</div>
<div style="font-size: 13px; ">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2d9d">namespace<span style="color: #000000"> MD5 {</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">class</span> GSROOT_DLL_EXPORT FingerPrint {</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2d9d"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre"></span></span>public<span style="color: #000000">:</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span>FingerPrint ();</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">virtual</span> ~FingerPrint () {};</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span>FingerPrint (<span style="color: #bb2d9d">unsigned</span>
<span style="color: #bb2d9d">char</span> fp[<span style="color: #2c2ecf">16</span>]);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px">
<br>
</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">void</span>                Set (<span style="color: #bb2d9d">unsigned</span>
<span style="color: #bb2d9d">char</span> fp[<span style="color: #2c2ecf">16</span>]);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">virtual</span><span class="Apple-tab-span" style="white-space:pre">
</span>GSErrCode<span class="Apple-tab-span" style="white-space:pre"> </span>Write (GS::OChannel& oc)
<span style="color: #bb2d9d">const</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">virtual</span><span class="Apple-tab-span" style="white-space:pre">
</span>GSErrCode<span class="Apple-tab-span" style="white-space:pre"> </span>Read (GS::IChannel& ic);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">virtual</span><span class="Apple-tab-span" style="white-space:pre">
</span>GSErrCode<span class="Apple-tab-span" style="white-space:pre"> </span>GetAsString (<span style="color: #bb2d9d">char</span>* md5String)
<span style="color: #bb2d9d">const</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">bool</span><span class="Apple-tab-span" style="white-space:pre">
</span>IsEmpty (<span style="color: #bb2d9d">void</span>) <span style="color: #bb2d9d">
const</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">void</span><span class="Apple-tab-span" style="white-space:pre">
</span>Clear (<span style="color: #bb2d9d">void</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">bool</span>               
<span style="color: #bb2d9d">operator</span> == (<span style="color: #bb2d9d">const</span> FingerPrint&<span class="Apple-tab-span" style="white-space:pre">
</span>rhs) <span style="color: #bb2d9d">const</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">bool</span>               
<span style="color: #bb2d9d">operator</span> != (<span style="color: #bb2d9d">const</span> FingerPrint&<span class="Apple-tab-span" style="white-space:pre">
</span>rhs) <span style="color: #bb2d9d">const</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span>FingerPrint&<span class="Apple-tab-span" style="white-space:pre">
</span><span style="color: #bb2d9d">operator</span>= (<span style="color: #bb2d9d">const</span> FingerPrint& source);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2d9d"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre"></span></span>public<span style="color: #000000">:</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">unsigned</span>
<span style="color: #bb2d9d">char</span>       data[<span style="color: #2c2ecf">16</span>];</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span>};</p>
</div>
<div style="font-size: 13px; ">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo">}</p>
</div>
<div style="font-size: 13px; "><br>
</div>
<div>The type of <span class="Apple-style-span" style="font-family: Menlo; "><span class="Apple-style-span" style="font-size: 11px;">gFloorPlanCutData</span><span style="font-family: Arial; "> is</span></span></div>
<div style="font-size: 13px; "><br>
</div>
<div style="font-size: 13px; ">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span style="color: #bb2d9d">class</span>   FloorPlanCutData:
<span style="color: #bb2d9d">public</span> GS::Object,</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span> 
<span style="color: #bb2d9d">public</span> GS::StateEventSource {</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px">
<br>
</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span>DECLARE_CLASS_INFO</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px">
<br>
</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #bb2d9d">private<span style="color: #000000">:</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">double</span>  currCutLevel;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">double</span>  topCutLevel;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">double</span>  bottomCutLevel;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">short</span>   topCutBaseStoryRelativeIndex;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">short</span>   bottomCutBaseStoryRelativeIndex;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px">
<br>
</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">double</span>  fixLevel2Absolute0;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px">
<br>
</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span>Int32<span class="Apple-tab-span" style="white-space:pre">
</span>lock;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px">
<br>
</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #008425"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre"></span></span>// temporary data dependent from the current story</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">double</span><span class="Apple-tab-span" style="white-space:pre">
</span>currCutLevelCalculated;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">double</span><span class="Apple-tab-span" style="white-space:pre">
</span>topCutLevelCalculated;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">double</span>  currentStoryLevel;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">double</span>  topBase2Current;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">double</span>  bottomBase2Current;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">short</span>   currentFloorIndex;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span><span style="color: #bb2d9d">bool</span><span class="Apple-tab-span" style="white-space:pre">
</span>relativeCalculated;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span>MD5::FingerPrint<span class="Apple-tab-span" style="white-space:pre">
</span>cutDataCheckSum;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><br>
</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"></span>...</p>
</div>
<div style="font-size: 13px; ">
<div>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">
}</p>
</div>
</div>
<div style="font-size: 13px; "><br>
</div>
<div style="font-size: 13px; ">The optimization kicks in because 'data' is 16-bytes; but there's no alignment check…</div>
<div style="font-size: 13px; "><br>
</div>
<div style="font-size: 13px; ">This seems to be a code generation error, but I couldn't reproduce it in a small application. Is this a known bug, or shall I adjust my build settings?</div>
<div style="font-size: 13px; "><br>
</div>
<div style="font-size: 13px; ">Thanks,</div>
<div style="font-size: 13px; "><br>
</div>
<div style="font-size: 13px; "><span class="Apple-style-span" style="font-family: Times; font-size: medium; "><strong style="font-family: Arial, sans-serif; font-size: 12pt; color: black; ">Ákos Somorjai</strong></span></div>
<div style="font-size: 13px; ">
<div>
<p style="font-family: Times; font-size: medium; "><font style="font-family: Arial, sans-serif; font-size: 9pt; color: black; ">Developer Support Manager</font><br>
<br>
<span style="font-size: 12pt; color: gray; font-family: Arial, sans-serif; ">GRAPHISOFT </span><span style="font-size: 9pt; color: gray; font-family: Arial, sans-serif; ">| Graphisoft Park 1. Budapest 1031 Hungary | +36 1 437-3000 | asomorjai@graphisoft.com</span></p>
</div>
<div><span style="font-size: 9pt; color: gray; font-family: Arial, sans-serif; "><br>
</span></div>
</div>
</div>
</div>
</body>
</html>