<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 23, 2017 at 5:59 PM, Friedman, Eli <span dir="ltr"><<a href="mailto:efriedma@codeaurora.org" target="_blank">efriedma@codeaurora.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 10/23/2017 1:02 PM, Andrew Kelley via llvm-dev wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have this test case in my frontend, which is triggering an assert in llvm master branch:<br>
<br>
fn fnWithAlignedStack() -> i32 {<br>
    @setAlignStack(1024);<br>
    return 1234;<br>
}<br>
<br>
It sets alignstack=1024 in the function attributes (see <a href="http://llvm.org/docs/LangRef.html#function-attributes" rel="noreferrer" target="_blank">http://llvm.org/docs/LangRef.h<wbr>tml#function-attributes</a>). It's tripping an assert:<br>
<br>
llvm/lib/IR/Attributes.cpp:134<wbr>: static llvm::Attribute llvm::Attribute::getWithStackA<wbr>lignment(llvm::LLVMContext&, uint64_t): Assertion `Align <= 0x100 && "Alignment too large."'<br>
<br>
Is 0x100 the correct maximum alignstack value? Can I submit a patch to document this in LangRef.html?<br>
</blockquote>
<br></span>
Yes...?  But nobody should ever specify a value anywhere near that large.<br></blockquote><div><br></div><div>Fair, but as a frontend I want to make this a friendly compile error and not a mysterious LLVM assertion failure :-)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
The point of the attribute is to fixup the stack alignment in cases of ABI mismatches, so you normally don't want to specify a value higher than the actual ABI alignment of the stack.  If you want to allocate aligned memory on the stack, you can just set the alignment of an alloca, and the code generator will provide memory with the appropriate alignment.</blockquote><div><br></div><div>Good to know, thanks.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888"><br>
<br>
-Eli<br>
<br>
-- <br>
Employee of Qualcomm Innovation Center, Inc.<br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project<br>
<br>
</font></span></blockquote></div><br></div></div>