[llvm-bugs] [Bug 48104] New: using #pragma omp simd along with -O2 lead to a segfault at runtime

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Nov 6 12:11:46 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=48104

            Bug ID: 48104
           Summary: using #pragma omp simd along with -O2 lead to a
                    segfault at runtime
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: evatux at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 24141
  --> https://bugs.llvm.org/attachment.cgi?id=24141&action=edit
simple reproducer

It seems #pragma omp simd may lead to omitting checking some conditionals
inside the loop.

See attached reproducer (also shown below). It is worth mentioning that the
issue appear only with -O2; with -O3 the test passes just fine.

$ clang++ -fopenmp -O2 repro_01.cpp && ./a.out; echo $?
139

$ clang++ -fopenmp -O3 repro_01.cpp && ./a.out; echo $?
0

Clang-version:
- 12-master (85f4be09124cc53e1a18a884ac7caf19988ab2a5, [2])
- 10, 9, 8, 7
- I haven't checked 11, and below 7.

OS:
- At least Linux and FreeBSD
- I haven't checked Windows

------

[1]

// repro_01.cpp
struct data_kernel_t {
    void operator()(float *dst, const float *ss) const
__attribute__((noinline)) {
#       pragma omp simd
        for (int c = 0; c < C_; ++c)
            dst[c] = (use_scaleshift_ ? ss[c] : 1.0f);
    }
    bool use_scaleshift_;
    int C_;
};

int main() {
    float dst[100];
    data_kernel_t ker{false, 100};
    ker(dst, nullptr);
    return 0;
}


[2]
commit 85f4be09124cc53e1a18a884ac7caf19988ab2a5
Author: Valentin Churavy <v.churavy at gmail.com>
Date:   Fri Nov 6 14:08:30 2020 -0500

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201106/21856643/attachment.html>


More information about the llvm-bugs mailing list