<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Global storage is used in an array subscript task reduction"
href="https://bugs.llvm.org/show_bug.cgi?id=52084">52084</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Global storage is used in an array subscript task reduction
</td>
</tr>
<tr>
<th>Product</th>
<td>OpenMP
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Clang Compiler Support
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rpenacob@bsc.es
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Analizing the following code it can be seen that the storage returned by
__kmpc_task_reduction_get_th_data is not used when performing the add
operation.
// t1.c
int gArray[10];
int main() {
#pragma omp taskgroup task_reduction(+: gArray[3])
{
for (int i = 0; i < 1e5; ++i) {
#pragma omp task in_reduction(+: gArray[3])
{
gArray[3]++;
}
}
}
}
// clang -fopenmp -S -emit-llvm t1.c
The relevant portion of code is:
%19 = call i8* @__kmpc_task_reduction_get_th_data(i32 %18, i8* %17, i8*
bitcast (i32* getelementptr inbounds ([10 x i32], [10 x i32]* @gArray, i64 0,
i64 3) to i8*)) #1
%conv.i = bitcast i8* %19 to i32*
%20 = getelementptr i32, i32* %conv.i, i64 sdiv exact (i64 sub (i64 ptrtoint
([10 x i32]* @gArray to i64), i64 ptrtoint (i32* getelementptr inbounds ([10 x
i32], [10 x i32]* @gArray, i64 0, i64 3) to i64)), i64 ptrtoint (i32*
getelementptr (i32, i32* null, i32 1) to i64))
%21 = bitcast i32* %20 to [10 x i32]*
%22 = load i32, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @gArray,
i64 0, i64 3), align 4
%inc.i = add nsw i32 %22, 1
store i32 %inc.i, i32* getelementptr inbounds ([10 x i32], [10 x i32]*
@gArray, i64 0, i64 3), align 4</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>