[Openmp-dev] Bug in clang/openmp: max-reduction fails if data type is "long double"
Stefan Illy via Openmp-dev
openmp-dev at lists.llvm.org
Thu Mar 10 23:35:44 PST 2016
Hello everybody,
When I compile the simple test program attached below I get the
following error message:
openmpbug.cc:(.text+0x2de): undefined reference to
`__sync_val_compare_and_swap_16'
openmpbug.cc:(.text+0x3a7): undefined reference to
`__sync_val_compare_and_swap_16'
clang-3.8: error: linker command failed with exit code 1 (use -v to see
invocation)
This is caused by the OMP max-reduction statement. It also fails if I
switch from "max" to "min".
I use version 3.8 of clang on an Ubuntu 14.04 LTS system. It also fails
with version 3.9 (trunk, self-compiled).
If I switch the floating point data type (real_t) from "long double" to
"double" or "float", the code compiles and runs without problems.
I hope this helps to make clang+openmp even better!
Here comes the simple test program:
---------------------------------------SNIP-------------------------------------------
#include <iostream>
using namespace std;
//typedef float real_t;
//typedef double real_t;
typedef long double real_t;
int
main()
{
real_t maxval = -1.0e-10;
#pragma omp parallel for reduction(max: maxval)
for (int i = 1; i <= 1000; i++) maxval = max(maxval, real_t(i));
cout << maxval << endl;
return 0;
}
------------------------------------SNIP------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4453 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20160311/b67a72da/attachment.bin>
More information about the Openmp-dev
mailing list