[Bug c/101262] New: GCC11 OpenMP optimization causes sigsegv on aligned constant array in darktable

johnnybit at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Jun 29 17:21:05 GMT 2021


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

            Bug ID: 101262
           Summary: GCC11 OpenMP optimization causes sigsegv on aligned
                    constant array in darktable
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johnnybit at gmail dot com
  Target Milestone: ---

A loop with constant length arrays with openmp and simd optimization crashes
with sigsegv when compilled with GCC11. Same code works with previous versions
and with various Clang versions

the code in question looks like

#define PIXEL_CHAN 8

static const float centers_ops[PIXEL_CHAN] DT_ALIGNED_ARRAY = {-56.0f / 7.0f,
// = -8.0f
                                                               -48.0f / 7.0f,
                                                               -40.0f / 7.0f,
                                                               -32.0f / 7.0f,
                                                               -24.0f / 7.0f,
                                                               -16.0f / 7.0f,
                                                                -8.0f / 7.0f,
                                                                 0.0f / 7.0f};

#pragma omp simd aligned(centers_ops, factors:64) safelen(PIXEL_CHAN)
reduction(+:result)
  for(int i = 0; i < PIXEL_CHAN; ++i)
    result += gaussian_func(expo - centers_ops[i], gauss_denom) * factors[i];


centers_ops is static const float [PIXEL_CHAN]
factors is const float *const restric factors (which is PIXEL_CHAN length)

the crash is on

result += gaussian_func(expo - centers_ops[i], gauss_denom) * factors[i];

line.

The reports in darktable are 
https://github.com/darktable-org/darktable/issues/9340
https://github.com/darktable-org/darktable/issues/9002


More information about the Gcc-bugs mailing list