<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 - Possible bug: LTO, LLVM 5.0.0, mac OS: certain calls get shadowed by functions from system library given -flto flag provided and do not otherwise"
   href="https://bugs.llvm.org/show_bug.cgi?id=34645">34645</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Possible bug: LTO, LLVM 5.0.0, mac OS: certain calls get shadowed by functions from system library given -flto flag provided and do not otherwise
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>5.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Linker
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>s.pankevich@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=19166" name="attach_19166" title="Minimal reproducible example">attachment 19166</a> <a href="attachment.cgi?id=19166&action=edit" title="Minimal reproducible example">[details]</a></span>
Minimal reproducible example

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
<a href="http://www.openlibm.org">http://www.openlibm.org</a>

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:
<a href="https://github.com/stanislaw/Examples/tree/20170916-llvm500-possible-lto-bug">https://github.com/stanislaw/Examples/tree/20170916-llvm500-possible-lto-bug</a>.</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>