FS#65541 - [clang] Code compiled with -Ofast fails to find math symbols.

Attached to Project: Arch Linux
Opened by Artur K. (nemerle) - Tuesday, 18 February 2020, 13:08 GMT
Last edited by Evangelos Foutras (foutrelis) - Friday, 24 April 2020, 00:46 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Evangelos Foutras (foutrelis)
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:
Any program compiled with clang -Ofast ( or -O2 -ffast-math ) that uses exp/pow/log etc functions, fails to link now.

Additional info:
* Using extra/clang 9.0.1-1 and core/glibc 2.31-1

Steps to reproduce:

1. Create the folowing file as 'test.cpp'
```
#include <cstdio>
int main(int argc,char **argv)
{
printf("%f\n",__builtin_expf(float(argv[1][0])));
return 0;
}
```
2. try to compile with `clang++ -Ofast z.cpp -lm`
3. error occurs:
/usr/bin/ld: /tmp/test-a8aed5.o: in function `main':
test.cpp:(.text+0xd): undefined reference to `__expf_finite'
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)

Note: in libm the `__expf_finite` exists as indirect function.
00000000000437c0 i __expf_finite
This task depends upon

Closed by  Evangelos Foutras (foutrelis)
Friday, 24 April 2020, 00:46 GMT
Reason for closing:  Fixed
Additional comments about closing:  clang 10.0.0-1
Comment by Artur K. (nemerle) - Tuesday, 18 February 2020, 13:19 GMT Comment by Nikolay Bogoychev (Dheart) - Wednesday, 26 February 2020, 18:11 GMT
I have submitted a bug report: https://bugs.llvm.org/show_bug.cgi?id=45034

Loading...