Open llvmbot opened 7 years ago
/cc /jfyi peter@pcc.me.uk
The following issue also exists on mac OS's system clang:
Apple LLVM version 8.1.0 (clang-802.0.42)
and manifests itself differently. In contrast to LLVM 5.0 example all the calls get shadowed given -flto flag is provided.
Extended Description
Please find the following minimal reproducible example in the attached:
This project is a very simplified setup extracted from openlibm library:
High quality system independent, portable, open source libm implementation http://www.openlibm.org
This repo has a function acos, certain calls to which seem to get shadowed by acos function from the standard library given the -flto flag is added. What is weird that there is no symmetry between compilation with and without -flto flag: only certain calls are shadowed while the rest still go through the custom acos function. For a contrast another function custom_acos is added - it is always called consistently with or without -flto flag (no shadowing occurs).
Important observation: valid inputs for acos function from the standard library are within range [-1, 1], for all other inputs it produces nan. In the logs for -flto below the calls of this function with invalid inputs like nan, -1.1, 1.1 do not get shadowed!
This issue is likely to affect all of the functions from openlibm library which interfere with the their corresponding functions from math.h.
The code is also pushed here: https://github.com/stanislaw/Examples/tree/20170916-llvm500-possible-lto-bug.