Skip to content

libc++ isnan(integer-type) broken on Windows with -std=c++20 after #69431 #70225

@petrhosek

Description

@petrhosek

libcxx/fuzzing/random.pass.cpp, std/depr/depr.c.headers/math_h.pass.cpp and std/numerics/c.math/cmath.pass.cpp are all failing with tip-of-tree Clang after #69431 landed:

# .---command stderr------------
# | In file included from C:\b\s\w\ir\x\w\llvm-llvm-project\libcxx\test\libcxx\fuzzing\random.pass.cpp:12:
# | In file included from C:/b/s/w/ir/x/w/llvm_build/include/c++/v1\cmath:319:
# | In file included from C:/b/s/w/ir/x/w/llvm_build/include/c++/v1\math.h:301:
# | In file included from C:\b\s\w\ir\cache\windows_sdk\Windows Kits\10\Include\10.0.19041.0\ucrt\math.h:11:
# | C:\b\s\w\ir\cache\windows_sdk\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h:413:16: error: call to 'fpclassify' is ambiguous
# |   413 |         return fpclassify(_X) == FP_NAN;
# |       |                ^~~~~~~~~~
# | C:\b\s\w\ir\x\w\llvm-llvm-project\libcxx\test\libcxx\fuzzing\random.pass.cpp:162:12: note: in instantiation of function template specialization 'isnan<short>' requested here
# |   162 |   if (std::isnan(res)) {
# |       |            ^
# | C:\b\s\w\ir\x\w\llvm-llvm-project\libcxx\test\libcxx\fuzzing\random.pass.cpp:174:10: note: in instantiation of function template specialization 'helper<std::uniform_int_distribution<short>>' requested here
# |   174 |   return helper<std::uniform_int_distribution<std::int16_t>>(data, size)       ||
# |       |          ^
# | C:\b\s\w\ir\cache\windows_sdk\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h:288:31: note: candidate function
# |   288 |     _Check_return_ inline int fpclassify(_In_ float _X) throw()
# |       |                               ^
# | C:\b\s\w\ir\cache\windows_sdk\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h:293:31: note: candidate function
# |   293 |     _Check_return_ inline int fpclassify(_In_ double _X) throw()
# |       |                               ^
# | C:\b\s\w\ir\cache\windows_sdk\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h:298:31: note: candidate function
# |   298 |     _Check_return_ inline int fpclassify(_In_ long double _X) throw()
# |       |                               ^
# | C:\b\s\w\ir\cache\windows_sdk\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h:413:16: error: call to 'fpclassify' is ambiguous
# |   413 |         return fpclassify(_X) == FP_NAN;
# |       |                ^~~~~~~~~~
# | C:\b\s\w\ir\x\w\llvm-llvm-project\libcxx\test\libcxx\fuzzing\random.pass.cpp:162:12: note: in instantiation of function template specialization 'isnan<bool>' requested here
# |   162 |   if (std::isnan(res)) {
# |       |            ^
# | C:\b\s\w\ir\x\w\llvm-llvm-project\libcxx\test\libcxx\fuzzing\random.pass.cpp:176:10: note: in instantiation of function template specialization 'helper<std::bernoulli_distribution>' requested here
# |   176 |          helper<std::bernoulli_distribution>(data, size)                       ||
# |       |          ^
# | C:\b\s\w\ir\cache\windows_sdk\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h:288:31: note: candidate function
# |   288 |     _Check_return_ inline int fpclassify(_In_ float _X) throw()
# |       |                               ^
# | C:\b\s\w\ir\cache\windows_sdk\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h:293:31: note: candidate function
# |   293 |     _Check_return_ inline int fpclassify(_In_ double _X) throw()
# |       |                               ^
# | C:\b\s\w\ir\cache\windows_sdk\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h:298:31: note: candidate function
# |   298 |     _Check_return_ inline int fpclassify(_In_ long double _X) throw()
# |       |                               ^
# | In file included from C:\b\s\w\ir\x\w\llvm-llvm-project\libcxx\test\libcxx\fuzzing\random.pass.cpp:16:
# | In file included from C:/b/s/w/ir/x/w/llvm_build/include/c++/v1\random:1686:
# | C:/b/s/w/ir/x/w/llvm_build/include/c++/v1\__random/clamp_to_integral.h:35:87: error: shift count is negative [-Werror,-Wshift-count-negative]
# |    35 |   return _FloatBigger ? numeric_limits<_IntT>::max() :  (numeric_limits<_IntT>::max() >> _Bits << _Bits);
# |       |                                                                                       ^  ~~~~~
# | C:/b/s/w/ir/x/w/llvm_build/include/c++/v1\__random/clamp_to_integral.h:46:27: note: in instantiation of function template specialization 'std::__max_representable_int_for_float<short, double, true, -38>' requested here
# |    46 |   const _IntT __max_val = __max_representable_int_for_float<_IntT, _RealT>();
# |       |                           ^
# | C:/b/s/w/ir/x/w/llvm_build/include/c++/v1\__random/poisson_distribution.h:181:31: note: in instantiation of function template specialization 'std::__clamp_to_integral<short, double>' requested here
# |   181 |                 return _VSTD::__clamp_to_integral<result_type>(__tx);
# |       |                               ^
# | C:/b/s/w/ir/x/w/llvm_build/include/c++/v1\__random/poisson_distribution.h:95:17: note: in instantiation of function template specialization 'std::poisson_distribution<short>::operator()<std::mersenne_twister_engine<unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>>' requested here
# |    95 |         {return (*this)(__g, __p_);}
# |       |                 ^
# | C:\b\s\w\ir\x\w\llvm-llvm-project\libcxx\test\libcxx\fuzzing\random.pass.cpp:161:23: note: in instantiation of function template specialization 'std::poisson_distribution<short>::operator()<std::mersenne_twister_engine<unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>>' requested here
# |   161 |   volatile auto res = d(engine);
# |       |                       ^
# | C:\b\s\w\ir\x\w\llvm-llvm-project\libcxx\test\libcxx\fuzzing\random.pass.cpp:177:10: note: in instantiation of function template specialization 'helper<std::poisson_distribution<short>>' requested here
# |   177 |          helper<std::poisson_distribution<std::int16_t>>(data, size)           ||
# |       |          ^
# | In file included from C:\b\s\w\ir\x\w\llvm-llvm-project\libcxx\test\libcxx\fuzzing\random.pass.cpp:16:
# | In file included from C:/b/s/w/ir/x/w/llvm_build/include/c++/v1\random:1686:
# | C:/b/s/w/ir/x/w/llvm_build/include/c++/v1\__random/clamp_to_integral.h:35:96: error: shift count is negative [-Werror,-Wshift-count-negative]
# |    35 |   return _FloatBigger ? numeric_limits<_IntT>::max() :  (numeric_limits<_IntT>::max() >> _Bits << _Bits);
# |       |                                                                                                ^  ~~~~~
# | 4 errors generated.
# `-----------------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions