<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 - Link error about __atomic_* when -fopenmp enabled"
href="https://bugs.llvm.org/show_bug.cgi?id=38026">38026</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Link error about __atomic_* when -fopenmp enabled
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>6.0
</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>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>m-takahiro@jp.fujitsu.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>When a following code is compiled with -fopenmp for x86 and aarch64 targets,
link error occurs.
------ complex.c --------
#include <complex.h>
void foo() {
double _Complex x, v, expr;
#pragma omp atomic write
x = 1 + I * 1.0;
#pragma omp atomic read
expr = x;
#pragma omp atomic update
x = x + expr;
#pragma omp atomic capture
{
v = x;
x = x + expr;
}
#pragma omp atomic capture
{
x = x + expr;
v = x;
}
}
-------------------------
For x86 target:
$ clang -O0 complex.c -fopenmp
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o: In function
`_start':
(.text+0x20): undefined reference to `main'
/tmp/complex-eb77c9.o: In function `foo':
complex.c:(.text+0x2f): undefined reference to `__atomic_store'
complex.c:(.text+0x45): undefined reference to `__atomic_load'
complex.c:(.text+0x89): undefined reference to `__atomic_load'
complex.c:(.text+0xd5): undefined reference to `__atomic_compare_exchange'
complex.c:(.text+0x112): undefined reference to `__atomic_load'
complex.c:(.text+0x17d): undefined reference to `__atomic_compare_exchange'
complex.c:(.text+0x1d7): undefined reference to `__atomic_load'
complex.c:(.text+0x245): undefined reference to `__atomic_compare_exchange'
For aarch64 target:
$ clang -fopenmp complex.c
/usr/lib/gcc/aarch64-redhat-linux/4.8.5/../../../../lib64/crt1.o: In function
`_start':
(.text+0x30): undefined reference to `main'
/tmp/complex-b0efaa.o: In function `foo':
complex.c:(.text+0x68): undefined reference to `__atomic_store'
complex.c:(.text+0x7c): undefined reference to `__atomic_load'
complex.c:(.text+0xbc): undefined reference to `__atomic_load'
complex.c:(.text+0x10c): undefined reference to `__atomic_compare_exchange'
complex.c:(.text+0x13c): undefined reference to `__atomic_load'
complex.c:(.text+0x194): undefined reference to `__atomic_compare_exchange'
complex.c:(.text+0x1e0): undefined reference to `__atomic_load'
complex.c:(.text+0x238): undefined reference to `__atomic_compare_exchange'</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>