<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 missing libm functions, ICE on reproducible"
   href="https://bugs.llvm.org/show_bug.cgi?id=52507">52507</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Possible missing libm functions, ICE on reproducible
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>OpenMP
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Clang Compiler Support
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jonathanchesterfield@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Test case reported by Wael Elwasif,

#include <omp.h>
#include <math.h>
#include <cstdio>

int main(int argc, char **argv){
     float a = 1.5;

#pragma omp target map(tofrom: a)
     {
     a = floor(a);
     }
     printf("a = %lf\n", a);
}

Reported failure mode:
clang++ -std=c++17 -lm -O3 -fopenmp -target x86_64-pc-linux-gnu
-fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa
-march=gfx90a  ./test_cmath.cpp
lld: error: undefined symbol: floorf

where changing the call to floorf, or the type to double, links OK.

However, on attempting to reproduce this, I get a segv on trunk:

<a href="https://godbolt.org/z/azsvd84fn">https://godbolt.org/z/azsvd84fn</a>

#3 0x0000558c2e2f6ff6 (anonymous
namespace)::AAKernelInfoFunction::changeToSPMDMode(llvm::Attributor&,
llvm::ChangeStatus&) (.constprop.1276) OpenMPOpt.cpp:0:0
 #4 0x0000558c2e2f7de7 (anonymous
namespace)::AAKernelInfoFunction::manifest(llvm::Attributor&) OpenMPOpt.cpp:0:0
 #5 0x0000558c2e22181c llvm::Attributor::manifestAttributes()
(/opt/compiler-explorer/clang-trunk-20211115/bin/clang-14+0x2c2181c)
 #6 0x0000558c2e22d61b llvm::Attributor::run()
(/opt/compiler-explorer/clang-trunk-20211115/bin/clang-14+0x2c2d61b)
 #7 0x0000558c2e300ec8 (anonymous namespace)::OpenMPOpt::runAttributor(bool)
(.part.1214) OpenMPOpt.cpp:0:0
 #8 0x0000558c2e301531 (anonymous namespace)::OpenMPOpt::run(bool)
OpenMPOpt.cpp:0:0
 #9 0x0000558c2e3044d7 llvm::OpenMPOptPass::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
(/opt/compiler-explorer/clang-trunk-20211115/bin/clang-14+0x2d044d7)

Bug was reported to me ~3 days ago.</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>