<div dir="ltr">Hi Philip:<div><br></div><div>Clang does check to make sure max alignment is <= 29, so that is consistent, however, <span style="color:rgb(0,0,0);font-family:Menlo,Consolas,Monaco,monospace;line-height:16px;white-space:pre-wrap">AggValueSlot stores it in an unsigned short. On my system, OSX, that means values >= 2**16 are stored as 0, which causes and assert/crash.</span></div><div><span style="color:rgb(0,0,0);font-family:Menlo,Consolas,Monaco,monospace;line-height:16px;white-space:pre-wrap"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Menlo,Consolas,Monaco,monospace;line-height:16px;white-space:pre-wrap">I submitted a patch over the weekend to change it to an unsigned, </span><font color="#000000" face="Menlo, Consolas, Monaco, monospace"><span style="line-height:16px;white-space:pre-wrap"><a href="http://reviews.llvm.org/D17248">http://reviews.llvm.org/D17248</a>, but it hasn't been reviewed yet.</span></font></div><div><font color="#000000" face="Menlo, Consolas, Monaco, monospace"><span style="font-size:10px;line-height:16px;white-space:pre-wrap"><br></span></font></div><div><font color="#000000" face="Menlo, Consolas, Monaco, monospace"><span style="line-height:16px;white-space:pre-wrap">thanks for taking a look...</span></font></div><div><font color="#000000" face="Menlo, Consolas, Monaco, monospace"><span style="line-height:16px;white-space:pre-wrap">don</span></font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 16, 2016 at 12:36 PM, Philip Reames <span dir="ltr"><<a href="mailto:listmail@philipreames.com" target="_blank">listmail@philipreames.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
From the LLVM perspective, the maximum alignment is specified as:<br>
<pre>In Value.h:
00520 <span> /// \brief The maximum alignment for instructions.</span>
<a name="109008352_l00521"></a>00521 <span> ///</span>
<a name="109008352_l00522"></a>00522 <span> /// This is the greatest alignment value supported by load, store, and alloca</span>
<a name="109008352_l00523"></a>00523 <span> /// instructions, and global values.</span>
<a name="109008352_l00524"></a><a href="http://llvm.org/docs/doxygen/html/classllvm_1_1Value.html#a50e02a54cc6f87a00a671265e1447e61" target="_blank">00524</a> <span></span> <span>static</span> <span>const</span> <span>unsigned</span> <a href="http://llvm.org/docs/doxygen/html/classllvm_1_1Value.html#a50e02a54cc6f87a00a671265e1447e61" title="The maximum alignment for instructions." target="_blank">MaxAlignmentExponent</a> = 29;
<a name="109008352_l00525"></a><a href="http://llvm.org/docs/doxygen/html/classllvm_1_1Value.html#a2885f6c5817ff68bc24bd1e22e221740" target="_blank">00525</a> <span>static</span> <span>const</span> <span>unsigned</span> <a href="http://llvm.org/docs/doxygen/html/classllvm_1_1Value.html#a2885f6c5817ff68bc24bd1e22e221740" target="_blank">MaximumAlignment</a> = 1u << <a href="http://llvm.org/docs/doxygen/html/classllvm_1_1Value.html#a50e02a54cc6f87a00a671265e1447e61" title="The maximum alignment for instructions." target="_blank">MaxAlignmentExponent</a>;
</pre>
This is checked in the Verifier via:<br>
Assert(GV.getAlignment() <= Value::MaximumAlignment,<br>
"huge alignment values are unsupported", &GV);<br>
(and similiar checks for Load, Store, Alloca, but not the various
atomic instructions)<div><div class="h5"><br>
<br>
<br>
<br>
<br>
<br>
<div>On 02/14/2016 01:30 PM, don hinton via
cfe-dev wrote:<br>
</div>
</div></div><blockquote type="cite"><div><div class="h5">
<div dir="ltr">
<pre style="white-space:pre-wrap;width:50em;color:rgb(0,0,0)"><span style="font-family:arial,sans-serif">Sema::AddAlignment() defines MaxValidAlignment like this:</span>
</pre>
<pre style="white-space:pre-wrap;width:50em;color:rgb(0,0,0)"> // Alignment calculations can wrap around if it's greater than 2**28.
unsigned MaxValidAlignment =
Context.getTargetInfo().getTriple().isOSBinFormatCOFF() ? 8192
: 268435456;
But AggValueSlot stores Alignment as an unsigned short:
class AggValueSlot {
...
unsigned short Alignment;
The max value for an unsigned short is 2**16 -1, but you are passing 2**16, which AddeAlignment says is okay. However, it ends up getting stored as 0 in an unsigned short.
The fix is to make these sizes consistent, but I'm not sure which should be changed (though I'm guessing Alignment should be unsigned instead of unsigned short).</pre>
</div>
<br>
<fieldset></fieldset>
<br>
</div></div><pre>_______________________________________________
cfe-dev mailing list
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
</blockquote>
<br>
</div>
</blockquote></div><br></div>