[cfe-dev] Clang crashing unexpectedly

Craig Topper via cfe-dev cfe-dev at lists.llvm.org
Sat Mar 16 15:22:34 PDT 2019


Only 4 of the builtins are documented as being usable by libraries here.
https://clang.llvm.org/docs/LanguageExtensions.html#c-coroutines-support-builtins
The others are listed as being for internal clang usage.

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.

~Craig


On Sat, Mar 16, 2019 at 6:31 AM Bruno Ricci via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

>
>
> On 16/03/2019 02:18, Zoe Carver via cfe-dev wrote:
> > 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).
> >
> > Here is a simple example of a program which crashes:
> >
> > int main () {
> >
> > return __builtin_coro_size();
> >
> > }
> >
> >
> > This behavior happens with many of the coroutine builtins. Take another
> example:
> >
> >
> > void* alloc = malloc(1024);
> >
> > void* ptr = __builtin_coro_begin(alloc);
> >
> > return __builtin_coro_free(ptr);
> >
> >
> > Here is a Godbolt to help demonstrate the problem:
> https://godbolt.org/z/L1v1rs
> >
> > 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".
> >
> > Anyway, let me know if you have questions. Hope this helps.
>
> 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).
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190316/c1332cbb/attachment.html>


More information about the cfe-dev mailing list