Windows-on-ARM-Experiments / mingw-woarm64-build

Workflows and build scripts for Windows on Arm64 GNU cross-compiler for `aarch64-w64-mingw32` target.
GNU General Public License v2.0
30 stars 4 forks source link

Compiler Segmentation fault when compiling code using NEON instructions #89

Closed Blackhex closed 7 months ago

Blackhex commented 8 months ago

After recent rebase the compiler started to crash on Segmentation fault (https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/actions/runs/7537288331/job/20516687201) when building libjpeg-turbo. The minimum repro-case was narrowed down to:

#include <arm_neon.h>

void test()
{
  while (1)
  {
    static const uint16_t jsimd_rgb_ycc_neon_consts[] = {19595, 0, 0, 0, 0, 0, 0, 0};
    uint16x8_t consts = vld1q_u16(jsimd_rgb_ycc_neon_consts);

    uint8_t tmp_buf[48];
    uint8x8x3_t input_pixels = vld3_u8(tmp_buf);
    uint16x8_t r = vmovl_u8(input_pixels.val[1]);
    uint32x4_t y_l = vmull_laneq_u16(vget_low_u16(r), consts, 0);

    uint32x4_t s = vdupq_n_u32(1);
    uint16x4_t a = vrshrn_n_u32(s, 16);
    uint16x4_t y = vrshrn_n_u32(y_l, 16);
    uint16x8_t ay = vcombine_u16(a, y);

    unsigned char ***out_buf;
    vst1_u8(out_buf[1][0], vmovn_u16(ay));
  }
}

built with:

aarch64-w64-mingw32-gcc  -O1 -c jccolor-neon.c

Disabling optimization or changing any line in the code above passed the build.

Blackhex commented 7 months ago

This was an upstream regression https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113485. It's resolved now.