<div dir="ltr"><div dir="ltr"><div>I found that clang crashes when it should not. I brought up the issue in the LLVM IRC channel earlier and was told to send an email describing the problem (the LLVM Bugzilla has not verified me yet).</div><div><br></div><div>Here is a simple example of a program which crashes:</div><div><br></div><div><div style="color:rgb(0,0,0);background-color:rgb(255,255,254)">
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">int main () {</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>return __builtin_coro_size();</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">}</span></p></div></div><div><br></div><div>This behavior happens with many of the <span style="color:rgb(0,0,0);font-family:SFProText-Regular;font-size:12px">coroutine builtins. Take another example:</span></div><div>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><br></span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">void* alloc = malloc(1024);</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">void* ptr = __builtin_coro_begin(alloc);</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">return __builtin_coro_free(ptr);</span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><br></span></p></div><div>Here is a Godbolt to help demonstrate the problem: <a href="https://godbolt.org/z/L1v1rs">https://godbolt.org/z/L1v1rs</a></div><div><br></div><div>I <i>think </i>(but totally might be wrong)<i> </i>that the issue has to do with clang ("CGBuiltin.cpp") returning a different type than was specified in "Builtins.def". </div><div><br></div><div>Anyway, let me know if you have questions. Hope this helps. </div></div></div>