<div dir="ltr"><div dir="ltr">Only 4 of the builtins are documented as being usable by libraries here. <a href="https://clang.llvm.org/docs/LanguageExtensions.html#c-coroutines-support-builtins">https://clang.llvm.org/docs/LanguageExtensions.html#c-coroutines-support-builtins</a>  The others are listed as being for internal clang usage.</div><div dir="ltr"><br></div><div dir="ltr">I suspect using these builtins by themselves isn't triggering the passes in LLVM that handle coroutines. So the intrinsic isn't being removed from IR before instruction selection.<br><div><div dir="ltr" class="gmail_signature"><br></div><div dir="ltr" class="gmail_signature">~Craig</div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 16, 2019 at 6:31 AM Bruno Ricci via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 16/03/2019 02:18, Zoe Carver via cfe-dev wrote:<br>
> 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).<br>
> <br>
> Here is a simple example of a program which crashes:<br>
> <br>
> int main () {<br>
> <br>
> return __builtin_coro_size();<br>
> <br>
> }<br>
> <br>
> <br>
> This behavior happens with many of the coroutine builtins. Take another example:<br>
> <br>
> <br>
> void* alloc = malloc(1024);<br>
> <br>
> void* ptr = __builtin_coro_begin(alloc);<br>
> <br>
> return __builtin_coro_free(ptr);<br>
> <br>
> <br>
> Here is a Godbolt to help demonstrate the problem: <a href="https://godbolt.org/z/L1v1rs" rel="noreferrer" target="_blank">https://godbolt.org/z/L1v1rs</a><br>
> <br>
> I /think /(but totally might be wrong)/ /that the issue has to do with clang ("CGBuiltin.cpp") returning a different type than was specified in "Builtins.def". <br>
> <br>
> Anyway, let me know if you have questions. Hope this helps. <br>
<br>
Am I reading this correctly ? The coroutine intrinsics have never worked since introduced in clang 4 ? (At least this is what I am getting on godbolt).<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>