Is this a bug in the implementation of Coroutines TS shipped with Clang 6.0?

Viewed 148

Below is a reproducible example:

AnyFutureWithInnerPromise<void> f()
{
    char arr[16]; // crash here due to segmentation fault
    co_return;
}

int main()
{
    f().get();
}

gdb tells me, the crash line is:

movaps XMMWORD PTR [rcx+0xb8],xmm0 

The cause is that movaps requires its operands to be 128-bit aligned, but XMMWORD PTR [rcx+0xb8] is not the case.

If I change the code as follows:

AnyFutureWithInnerPromise<void> f()
{
    std::uint64_t n; // add 8-bytes to make arr 128-bit aligned
    char arr[16]; // ok now        
    co_return;
}

The new assembly instruction is:

movaps XMMWORD PTR [rcx+0xc0],xmm0

Is this a bug in the implementation of Coroutines TS shipped with Clang 6.0?

0 Answers
Related