<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 - Undefined symbol when -polly-parallel is enabled"
href="https://bugs.llvm.org/show_bug.cgi?id=38493">38493</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Undefined symbol when -polly-parallel is enabled
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>Support Libraries
</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 automatic parallelization using polly is applied, a linker outputs an
error: undefined symbol: GOMP_*.
-------- test.c --------
#include <stdio.h>
#include <math.h>
#define N 300
#define M 4
double a[N][M];
double b[N][M];
double c[N][M];
void foo(int m) {
int i,j;
for (j=0; j<N; ++j) {
for (i=0; i<m; ++i) {
a[j][i] += b[j][i]*c[j][i];
}
}
}
double suma(void) {
int i,j;
double s;
s = 0.0;
for (j=0; j<N; ++j) {
for (i=0; i<M; ++i) {
s += a[j][i];
}
}
return s;
}
#define ANS (double)300.0000
#define GOSA (double)0.0
int main(void) {
int i,j;
double s;
for (j=0; j<N; ++j) {
for (i=0; i<M; ++i) {
a[j][i] = 0.0;
b[j][i] = 0.5;
c[j][i] = 0.5;
}
}
foo(M);
s = suma();
if (fabs(s - ANS) <= GOSA) {
printf("ok\n");
} else {
printf("ng: %lf != %lf\n", s, ANS);
}
}
---------------------
$ clang --version
clang version 8.0.0 (trunk 339303)
Target: x86_64-unknown-linux-gnu
$ clang -O3 -mllvm -polly -mllvm -polly-parallel test.c
ld: error: undefined symbol: GOMP_parallel_loop_runtime_start
<span class="quote">>>> referenced by 3-P-275_01.c
>>> /home/takahiro/tmp/3-P-275_01-0c2466.o:(foo)</span >
ld: error: undefined symbol: GOMP_parallel_end
<span class="quote">>>> referenced by 3-P-275_01.c
>>> /home/takahiro/tmp/3-P-275_01-0c2466.o:(foo)</span >
ld: error: undefined symbol: GOMP_loop_runtime_next
<span class="quote">>>> referenced by 3-P-275_01.c
>>> /home/takahiro/tmp/3-P-275_01-0c2466.o:(foo_polly_subfn)</span >
ld: error: undefined symbol: GOMP_loop_runtime_next
<span class="quote">>>> referenced by 3-P-275_01.c
>>> /home/takahiro/tmp/3-P-275_01-0c2466.o:(foo_polly_subfn)</span >
ld: error: undefined symbol: GOMP_loop_end_nowait
<span class="quote">>>> referenced by 3-P-275_01.c
>>> /home/takahiro/tmp/3-P-275_01-0c2466.o:(foo_polly_subfn)</span >
But, If I added -fopenmp option to the above options, the linker didn't output
the error and compilation succeeded. So, when -polly-parallel option is
specified, should I need to specify -fopenmp option? Or, should clang pass
"-lomp" to the linker implicitly?</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>