[llvm-bugs] [Bug 38493] New: Undefined symbol when -polly-parallel is enabled
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Aug 8 18:47:11 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=38493
Bug ID: 38493
Summary: Undefined symbol when -polly-parallel is enabled
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Support Libraries
Assignee: unassignedbugs at nondot.org
Reporter: m-takahiro at jp.fujitsu.com
CC: llvm-bugs at lists.llvm.org
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
>>> referenced by 3-P-275_01.c
>>> /home/takahiro/tmp/3-P-275_01-0c2466.o:(foo)
ld: error: undefined symbol: GOMP_parallel_end
>>> referenced by 3-P-275_01.c
>>> /home/takahiro/tmp/3-P-275_01-0c2466.o:(foo)
ld: error: undefined symbol: GOMP_loop_runtime_next
>>> referenced by 3-P-275_01.c
>>> /home/takahiro/tmp/3-P-275_01-0c2466.o:(foo_polly_subfn)
ld: error: undefined symbol: GOMP_loop_runtime_next
>>> referenced by 3-P-275_01.c
>>> /home/takahiro/tmp/3-P-275_01-0c2466.o:(foo_polly_subfn)
ld: error: undefined symbol: GOMP_loop_end_nowait
>>> referenced by 3-P-275_01.c
>>> /home/takahiro/tmp/3-P-275_01-0c2466.o:(foo_polly_subfn)
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?
--
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/20180809/8c6e64fd/attachment-0001.html>
More information about the llvm-bugs
mailing list