[llvm-bugs] [Bug 47606] New: OpenMP compile error for lastprivate array member if also firstprivate
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Sep 21 14:59:40 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47606
Bug ID: 47606
Summary: OpenMP compile error for lastprivate array member if
also firstprivate
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: OpenMP
Assignee: unassignedclangbugs at nondot.org
Reporter: michael.p.rice at intel.com
CC: llvm-bugs at lists.llvm.org
If an array member is used in both firstprivate and lastprivate clauses an
error will occur:
<source>:21:56: error: array type 'char [4]' is not assignable
#pragma omp parallel for firstprivate(y) lastprivate(y)
^
But no problem if firstprivate is not used.
#include <stdio.h>
int fails;
struct my_struct {
char y[4];
void work();
void init() { for (int i=0;i<4;++i) y[i] = i; }
void check() { if (y[3]!=42) fails++; }
my_struct() {}
};
void my_struct::work() {
init();
#pragma omp parallel for lastprivate(y)
for (int i=0;i<4;++i) {
y[i] = 42;
}
check();
init();
#pragma omp parallel for firstprivate(y) lastprivate(y)
for (int i=0;i<4;++i) {
y[i] = 42;
}
check();
}
int main()
{
my_struct s;
s.work();
if (fails) printf("failed\n");
else printf("passed\n");
return fails;
}
https://godbolt.org/z/6E9Po5
--
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/20200921/64241876/attachment-0001.html>
More information about the llvm-bugs
mailing list