ldc icon indicating copy to clipboard operation
ldc copied to clipboard

Casting array to vector is too permissive

Open kinke opened this issue 3 years ago • 0 comments

This compiles:

import core.simd;

auto foo()
{
    int[3] arr;
    return cast(int4) arr;
}

auto bar(int[] arr)
{
    return cast(int4) arr;
}

In both cases, we simply memcpy the first 16 bytes - reading beyond the static array and skipping all bounds/length checks for the slice.

kinke avatar May 20 '22 14:05 kinke