llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h:164:9: error: no viable conversion from '__llvm_libc_19_0_0_git::fputil::FPBits<float>' to 'float'

Open rudkx opened this issue 2 years ago • 10 comments

I'm building on macOS using Xcode 15.2 with my repo at commit 79709498eaa5 and hitting these errors:

/Users/rudkx/src/llvm-project/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h:164:9: error: no viable conversion from '__llvm_libc_19_0_0_git::fputil::FPBits<float>' to 'float'
  164 |   float large_value = FPBits<float>::max_normal();
      |         ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/rudkx/src/llvm-project/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h:165:9: error: no viable conversion from '__llvm_libc_19_0_0_git::fputil::FPBits<float>' to 'float'
  165 |   float small_value = FPBits<float>::min_normal();
      |         ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/rudkx/src/llvm-project/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h:280:33: error: implicit conversion loses integer precision: 'const uint64_t' (aka 'const unsigned long long') to 'uint32_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
  280 |   FEnv::set_control_word(state->ControlWord);
      |   ~~~~                   ~~~~~~~^~~~~~~~~~~
/Users/rudkx/src/llvm-project/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h:281:32: error: implicit conversion loses integer precision: 'const uint64_t' (aka 'const unsigned long long') to 'uint32_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
  281 |   FEnv::set_status_word(state->StatusWord);
      |   ~~~~                  ~~~~~~~^~~~~~~~~~
4 errors generated.

I configured and built like this:

cmake -S llvm -B assert -G Ninja -DLLVM_ENABLE_PROJECTS="clang;mlir;openmp;pstl" -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libc;libunwind;libcxxabi;libcxx;compiler-rt"

cmake --build assert

rudkx avatar Feb 19 '24 04:02 rudkx

@llvm/issue-subscribers-libc

Author: Mark Lacey (rudkx)

I'm building on macOS using Xcode 15.2 with my repo at commit `79709498eaa5` and hitting these errors:
/Users/rudkx/src/llvm-project/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h:164:9: error: no viable conversion from '__llvm_libc_19_0_0_git::fputil::FPBits&lt;float&gt;' to 'float'
  164 |   float large_value = FPBits&lt;float&gt;::max_normal();
      |         ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/rudkx/src/llvm-project/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h:165:9: error: no viable conversion from '__llvm_libc_19_0_0_git::fputil::FPBits&lt;float&gt;' to 'float'
  165 |   float small_value = FPBits&lt;float&gt;::min_normal();
      |         ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/rudkx/src/llvm-project/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h:280:33: error: implicit conversion loses integer precision: 'const uint64_t' (aka 'const unsigned long long') to 'uint32_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
  280 |   FEnv::set_control_word(state-&gt;ControlWord);
      |   ~~~~                   ~~~~~~~^~~~~~~~~~~
/Users/rudkx/src/llvm-project/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h:281:32: error: implicit conversion loses integer precision: 'const uint64_t' (aka 'const unsigned long long') to 'uint32_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
  281 |   FEnv::set_status_word(state-&gt;StatusWord);
      |   ~~~~                  ~~~~~~~^~~~~~~~~~
4 errors generated.

I configured and built like this:

cmake -S llvm -B assert -G Ninja -DLLVM_ENABLE_PROJECTS="clang;mlir;openmp;pstl" -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libc;libunwind;libcxxabi;libcxx;compiler-rt"

cmake --build assert

llvmbot avatar Feb 19 '24 04:02 llvmbot

following

moshe-foreflight avatar Feb 20 '24 19:02 moshe-foreflight

I don't have an ARM mac to test right now, but it looks like both of those would be solved by casting to the correct type.

For the FPBits calls add .get_val() on the end. For the set_*_word calls add a static_cast<uint32_t>.

I'll see about getting a patch out for those in a bit, or if you send me the patch I'll approve it.

michaelrj-google avatar Feb 20 '24 20:02 michaelrj-google

Best place to submit a patch? I'll give it a shot.

moshe-foreflight avatar Feb 20 '24 21:02 moshe-foreflight

the easiest way is to create a github PR and add me as a reviewer. If you don't want to do that then you can just send me the diff and I can create the PR for you, though that'll take a bit longer.

michaelrj-google avatar Feb 20 '24 21:02 michaelrj-google

I can do that, np.

moshe-foreflight avatar Feb 20 '24 22:02 moshe-foreflight

@michaelrj-google Created https://github.com/llvm/llvm-project/pull/82429 but it's not letting me add reviewers.

MosheBerman avatar Feb 20 '24 22:02 MosheBerman

Do we get to close this now?

moshe-foreflight avatar Feb 20 '24 22:02 moshe-foreflight

Forgot to mention, if you put Fixes: https://github.com/llvm/llvm-project/issues/82205 in your commit message it will close automatically when the patch lands.

jhuber6 avatar Feb 20 '24 22:02 jhuber6

Neat.

moshe-foreflight avatar Feb 20 '24 22:02 moshe-foreflight