public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "johnnybit at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/101262] New: GCC11 OpenMP optimization causes sigsegv on aligned constant array in darktable
Date: Tue, 29 Jun 2021 17:21:05 +0000	[thread overview]
Message-ID: <bug-101262-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             reply	other threads:[~2021-06-29 17:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29 17:21 johnnybit at gmail dot com [this message]
2021-06-29 17:54 ` [Bug middle-end/101262] " jakub at gcc dot gnu.org
2021-06-29 19:06 ` johnnybit at gmail dot com
2021-06-29 22:45 ` jakub at gcc dot gnu.org
2021-06-30  4:22 ` johnnybit at gmail dot com
2021-06-30  4:42 ` marxin at gcc dot gnu.org
2021-06-30  6:36 ` [Bug middle-end/101262] [11/12 Regression] " rguenth at gcc dot gnu.org
2021-07-28  7:07 ` rguenth at gcc dot gnu.org
2022-04-21  7:49 ` rguenth at gcc dot gnu.org
2023-05-29 10:05 ` [Bug middle-end/101262] [11/12/13/14 " jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-101262-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).