<div>A correction:</div><div><br></div><div>After reading the assembly code, the problem is when stack memory allocation is happening between the stack subtraction and the actual function call.</div><div><br></div><div>For example, the correct call to sin is:</div>

<div><br></div><div>sub esp, 8</div><div>move [esp], xmm0    ; line 1</div><div>call sin</div><div>add esp, 8</div><div><br></div><div>While the generated code adds some stack allocation after line 1 as follows:</div><div>

<br></div><div>sub esp, 8</div><div>move [esp], xmm0</div><div>    move eax, 10h</div><div>    call chkstk ; allocate more stack</div><div>    mov         esi,esp  </div><div>    mov         eax,dword ptr [ebp-278h]  </div>

<div>    mov         dword ptr [esi+8],eax  </div><div>    mov         eax,dword ptr [ebp-274h]  </div><div>    mov         dword ptr [esi+4],eax  </div><div>    mov         eax,dword ptr [ebp-26Ch]  </div><div>    mov         dword ptr [esi],eax  </div>

<div>call sin</div><div>add esp, 8</div><div><br></div><div>This causes the stack pointer is pointing to the some user data, i.e., 8 bytes above the true stack top.</div><div><br></div><div>Does any one have any idea to prevent the above stack allocation?</div>

<div><br></div><div>Thanks,</div><div>-Peng</div><div><br></div><br><div class="gmail_quote">On Wed, Jan 30, 2013 at 3:38 PM, Peng Cheng <span dir="ltr"><<a href="mailto:gm4cheng@gmail.com" target="_blank">gm4cheng@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Bug is reported with test cases.  see <a href="http://llvm.org/bugs/show_bug.cgi?id=15124" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=15124</a> .<div>

<br></div><div>Thanks,</div><div>-Peng<div><div class="h5"><br><br><div class="gmail_quote">On Wed, Jan 30, 2013 at 12:14 PM, Anton Korobeynikov <span dir="ltr"><<a href="mailto:anton@korobeynikov.info" target="_blank">anton@korobeynikov.info</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>> Has anyone seen this problem before?  and is there any fix or work around<br>
> for that?<br>
</div>Please provide a testcase and fill LLVM problem report into bugzilla.<br>
<br>
Thanks!<br>
<br>
--<br>
With best regards, Anton Korobeynikov<br>
Faculty of Mathematics and Mechanics, Saint Petersburg State University<br>
</blockquote></div><br></div></div></div>
</blockquote></div><br>