https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98428

            Bug ID: 98428
           Summary: [11 regression] ICE with omp simd loop + optimization
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: e...@coeus-group.com
  Target Milestone: ---

This is based on the gcc-11 currently in Debian experimental (gcc-11 (Debian
11-20201216-2) 11.0.0 20201216 (experimental) [master revision
4e42f6ebf48:da5e758223c:134afa38f0befc49f51747f3afe931fa4707c2f8]), but as
you'll see the build on Compiler Explorer also fails.

I'm getting an ICE when attempting to compile SIMDe on GCC 11 on x86_64 with
-O1.  Here is a minimized test case (or, on Compiler Explorer if you prefer:
<https://godbolt.org/z/Kb7MWf>):

    #include <emmintrin.h>
    typedef struct {
      float d[4];
    } f;
    typedef __m128 e;
    f k;
    float ak;
    e j;
    f fn1(e g) {
      __builtin_memcpy(&k, &g, sizeof(k));
      return k;
    }
    typedef struct {
      float d[8];
    } ag;
    void l() {
      ag ao;
      f ap = fn1(j);

    #pragma omp simd
      for (size_t i = 0; i < sizeof(ao.d[0]); i += 2)
        ao.d[i] = ao.d[i + 1] = ap.d[1];
      ag g = ao;
      __builtin_memcpy(&ak, &g, ak);
    }
    int main() {}

It generates an ICE with `-O1 -fopenmp-simd`. but removing either -O1 or
-fopenmp-simd makes compilation succeed.  This only happens on gcc-11; gcc-10
works as expected.

The original code which I fed into C-Reduce is at
<https://github.com/simd-everywhere/simde/blob/76790a981bedab5dc1c8e393f8dccf0ea0e3917d/test/x86/avx512/broadcast.c#L772-L820>,
and the `simde_mm512_maskz_broadcast_f64x2` function it calls is at
<https://github.com/simd-everywhere/simde/blob/76790a981bedab5dc1c8e393f8dccf0ea0e3917d/simde/x86/avx512/broadcast.h#L255-L267>

Reply via email to