STL icon indicating copy to clipboard operation
STL copied to clipboard

Clang 18+ `/fp:fast` emits `-Wnan-infinity-disabled` in `VSO_0000000_vector_algorithms_floats`

Open CaseyCarter opened this issue 1 year ago • 7 comments

All 8 clang-cl /fp:fast configs have the same issue. For example:

Error log for clang-cl /fp:fast /MT without /D_USE_STD_VECTOR_ALGORITHMS=0
FAIL: std :: tests/VSO_0000000_vector_algorithms_floats:16 (6 of 24)
******************** TEST 'std :: tests/VSO_0000000_vector_algorithms_floats:16' FAILED ********************
Build setup steps:
Build steps:
Build step failed unexpectedly.
Command: "c:\Program Files\LLVM19\bin\clang-cl.EXE" "C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp" "-IC:\STL\out\x64\out\inc" "-IC:\STL\llvm-project\libcxx\test\support" "-IC:\STL\tests\std\include" "/nologo" "/Od" "/W4" "/w14061" "/w14242" "/w14265" "/w14582" "/w14583" "/w14587" "/w14588" "/w14749" "/w14841" "/w14842" "/w15038" "/w15214" "/w15215" "/w15216" "/w15217" "/w15262" "/sdl" "/WX" "/D_ENABLE_STL_INTERNAL_CHECK" "/bigobj" "/FIforce_include.hpp" "/w14365" "/w14668" "/w15267" "/D_ENFORCE_FACET_SPECIALIZATIONS=1" "/D_STL_CALL_ABORT_INSTEAD_OF_INVALID_PARAMETER" "-fno-ms-compatibility" "-fno-delayed-template-parsing" "-Wno-unqualified-std-cast-call" "/EHsc" "/MT" "/std:c++20" "/permissive-" "/w14640" "/Zc:threadSafeInit-" "--start-no-unused-arguments" "/fp:fast" "-m64" "-FeC:\STL\out\x64\tests\std\tests\VSO_0000000_vector_algorithms_floats\Output\16\VSO_0000000_vector_algorithms_floats.exe" "-link" "-LIBPATH:C:\STL\out\x64\out\lib\amd64" "-LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.42.34226\lib\x64" "/MANIFEST:EMBED"
Exit Code: 1 (0x1)
Standard Error:
--
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:5:
C:\STL\out\x64\out\inc\limits(883,16): error: use of NaN is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  883 |         return __builtin_nanf("0");
      |                ^~~~~~~~~~~~~~~~~~~
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:6:
In file included from C:\STL\out\x64\out\inc\random:13:
C:\STL\out\x64\out\inc\cmath(671,1): error: use of infinity is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  671 | _CLANG_BUILTIN1(isfinite)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(662,5): note: expanded from macro '_CLANG_BUILTIN1'
  662 |     _CLANG_BUILTIN1_ARG(NAME, float)  \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(605,16): note: expanded from macro '_CLANG_BUILTIN1_ARG'
  605 |         return __builtin_##NAME(_Xx);                                                            \
      |                ^~~~~~~~~~~~~~~~~~~~~
(196,1): note: expanded from here
  196 | __builtin_isfinite
      | ^
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:6:
In file included from C:\STL\out\x64\out\inc\random:13:
C:\STL\out\x64\out\inc\cmath(671,1): error: use of infinity is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  671 | _CLANG_BUILTIN1(isfinite)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(663,5): note: expanded from macro '_CLANG_BUILTIN1'
  663 |     _CLANG_BUILTIN1_ARG(NAME, double) \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(605,16): note: expanded from macro '_CLANG_BUILTIN1_ARG'
  605 |         return __builtin_##NAME(_Xx);                                                            \
      |                ^~~~~~~~~~~~~~~~~~~~~
(199,1): note: expanded from here
  199 | __builtin_isfinite
      | ^
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:6:
In file included from C:\STL\out\x64\out\inc\random:13:
C:\STL\out\x64\out\inc\cmath(671,1): error: use of infinity is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  671 | _CLANG_BUILTIN1(isfinite)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(664,5): note: expanded from macro '_CLANG_BUILTIN1'
  664 |     _CLANG_BUILTIN1_ARG(NAME, long double)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(605,16): note: expanded from macro '_CLANG_BUILTIN1_ARG'
  605 |         return __builtin_##NAME(_Xx);                                                            \
      |                ^~~~~~~~~~~~~~~~~~~~~
(202,1): note: expanded from here
  202 | __builtin_isfinite
      | ^
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:6:
In file included from C:\STL\out\x64\out\inc\random:13:
C:\STL\out\x64\out\inc\cmath(672,1): error: use of infinity is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  672 | _CLANG_BUILTIN1(isinf)
      | ^~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(662,5): note: expanded from macro '_CLANG_BUILTIN1'
  662 |     _CLANG_BUILTIN1_ARG(NAME, float)  \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(605,16): note: expanded from macro '_CLANG_BUILTIN1_ARG'
  605 |         return __builtin_##NAME(_Xx);                                                            \
      |                ^~~~~~~~~~~~~~~~~~~~~
(205,1): note: expanded from here
  205 | __builtin_isinf
      | ^
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:6:
In file included from C:\STL\out\x64\out\inc\random:13:
C:\STL\out\x64\out\inc\cmath(672,1): error: use of infinity is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  672 | _CLANG_BUILTIN1(isinf)
      | ^~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(663,5): note: expanded from macro '_CLANG_BUILTIN1'
  663 |     _CLANG_BUILTIN1_ARG(NAME, double) \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(605,16): note: expanded from macro '_CLANG_BUILTIN1_ARG'
  605 |         return __builtin_##NAME(_Xx);                                                            \
      |                ^~~~~~~~~~~~~~~~~~~~~
(208,1): note: expanded from here
  208 | __builtin_isinf
      | ^
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:6:
In file included from C:\STL\out\x64\out\inc\random:13:
C:\STL\out\x64\out\inc\cmath(672,1): error: use of infinity is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  672 | _CLANG_BUILTIN1(isinf)
      | ^~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(664,5): note: expanded from macro '_CLANG_BUILTIN1'
  664 |     _CLANG_BUILTIN1_ARG(NAME, long double)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(605,16): note: expanded from macro '_CLANG_BUILTIN1_ARG'
  605 |         return __builtin_##NAME(_Xx);                                                            \
      |                ^~~~~~~~~~~~~~~~~~~~~
(211,1): note: expanded from here
  211 | __builtin_isinf
      | ^
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:6:
In file included from C:\STL\out\x64\out\inc\random:13:
C:\STL\out\x64\out\inc\cmath(673,1): error: use of NaN is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  673 | _CLANG_BUILTIN1(isnan)
      | ^~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(662,5): note: expanded from macro '_CLANG_BUILTIN1'
  662 |     _CLANG_BUILTIN1_ARG(NAME, float)  \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(605,16): note: expanded from macro '_CLANG_BUILTIN1_ARG'
  605 |         return __builtin_##NAME(_Xx);                                                            \
      |                ^~~~~~~~~~~~~~~~~~~~~
(214,1): note: expanded from here
  214 | __builtin_isnan
      | ^
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:6:
In file included from C:\STL\out\x64\out\inc\random:13:
C:\STL\out\x64\out\inc\cmath(673,1): error: use of NaN is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  673 | _CLANG_BUILTIN1(isnan)
      | ^~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(663,5): note: expanded from macro '_CLANG_BUILTIN1'
  663 |     _CLANG_BUILTIN1_ARG(NAME, double) \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(605,16): note: expanded from macro '_CLANG_BUILTIN1_ARG'
  605 |         return __builtin_##NAME(_Xx);                                                            \
      |                ^~~~~~~~~~~~~~~~~~~~~
(217,1): note: expanded from here
  217 | __builtin_isnan
      | ^
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:6:
In file included from C:\STL\out\x64\out\inc\random:13:
C:\STL\out\x64\out\inc\cmath(673,1): error: use of NaN is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  673 | _CLANG_BUILTIN1(isnan)
      | ^~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(664,5): note: expanded from macro '_CLANG_BUILTIN1'
  664 |     _CLANG_BUILTIN1_ARG(NAME, long double)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(605,16): note: expanded from macro '_CLANG_BUILTIN1_ARG'
  605 |         return __builtin_##NAME(_Xx);                                                            \
      |                ^~~~~~~~~~~~~~~~~~~~~
(220,1): note: expanded from here
  220 | __builtin_isnan
      | ^
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:6:
In file included from C:\STL\out\x64\out\inc\random:13:
C:\STL\out\x64\out\inc\cmath(681,1): error: use of NaN is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  681 | _CLANG_BUILTIN2(isunordered)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(667,5): note: expanded from macro '_CLANG_BUILTIN2'
  667 |     _CLANG_BUILTIN2_ARG(NAME, float)  \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(611,16): note: expanded from macro '_CLANG_BUILTIN2_ARG'
  611 |         return __builtin_##NAME(_Xx, _Yx);                                                               \
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~
(293,1): note: expanded from here
  293 | __builtin_isunordered
      | ^
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:6:
In file included from C:\STL\out\x64\out\inc\random:13:
C:\STL\out\x64\out\inc\cmath(681,1): error: use of NaN is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  681 | _CLANG_BUILTIN2(isunordered)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(668,5): note: expanded from macro '_CLANG_BUILTIN2'
  668 |     _CLANG_BUILTIN2_ARG(NAME, double) \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(611,16): note: expanded from macro '_CLANG_BUILTIN2_ARG'
  611 |         return __builtin_##NAME(_Xx, _Yx);                                                               \
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~
(297,1): note: expanded from here
  297 | __builtin_isunordered
      | ^
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:6:
In file included from C:\STL\out\x64\out\inc\random:13:
C:\STL\out\x64\out\inc\cmath(681,1): error: use of NaN is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  681 | _CLANG_BUILTIN2(isunordered)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(669,5): note: expanded from macro '_CLANG_BUILTIN2'
  669 |     _CLANG_BUILTIN2_ARG(NAME, long double)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(611,16): note: expanded from macro '_CLANG_BUILTIN2_ARG'
  611 |         return __builtin_##NAME(_Xx, _Yx);                                                               \
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~
(301,1): note: expanded from here
  301 | __builtin_isunordered
      | ^
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:6:
In file included from C:\STL\out\x64\out\inc\random:13:
C:\STL\out\x64\out\inc\cmath(688,1): error: use of NaN is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  688 | _CLANG_BUILTIN2_TEMPLATED(isunordered)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(641,5): note: expanded from macro '_CLANG_BUILTIN2_TEMPLATED'
  641 |     _CLANG_BUILTIN2_ARG_TEMPLATED(NAME, float)              \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(617,16): note: expanded from macro '_CLANG_BUILTIN2_ARG_TEMPLATED'
  617 |         return __builtin_##NAME(static_cast(_Xx), static_cast(_Yx));                     \
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(81,1): note: expanded from here
   81 | __builtin_isunordered
      | ^
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:6:
In file included from C:\STL\out\x64\out\inc\random:13:
C:\STL\out\x64\out\inc\cmath(688,1): error: use of NaN is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  688 | _CLANG_BUILTIN2_TEMPLATED(isunordered)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(642,5): note: expanded from macro '_CLANG_BUILTIN2_TEMPLATED'
  642 |     _CLANG_BUILTIN2_ARG_TEMPLATED(NAME, double)             \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(617,16): note: expanded from macro '_CLANG_BUILTIN2_ARG_TEMPLATED'
  617 |         return __builtin_##NAME(static_cast(_Xx), static_cast(_Yx));                     \
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(85,1): note: expanded from here
   85 | __builtin_isunordered
      | ^
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:6:
In file included from C:\STL\out\x64\out\inc\random:13:
C:\STL\out\x64\out\inc\cmath(688,1): error: use of NaN is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  688 | _CLANG_BUILTIN2_TEMPLATED(isunordered)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(643,5): note: expanded from macro '_CLANG_BUILTIN2_TEMPLATED'
  643 |     _CLANG_BUILTIN2_ARG_TEMPLATED(NAME, long double)        \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(617,16): note: expanded from macro '_CLANG_BUILTIN2_ARG_TEMPLATED'
  617 |         return __builtin_##NAME(static_cast(_Xx), static_cast(_Yx));                     \
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(89,1): note: expanded from here
   89 | __builtin_isunordered
      | ^
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:6:
In file included from C:\STL\out\x64\out\inc\random:13:
C:\STL\out\x64\out\inc\cmath(688,1): error: use of NaN is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  688 | _CLANG_BUILTIN2_TEMPLATED(isunordered)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(644,5): note: expanded from macro '_CLANG_BUILTIN2_TEMPLATED'
  644 |     _CLANG_BUILTIN2_ARG_TEMPLATED(NAME, signed char)        \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(617,16): note: expanded from macro '_CLANG_BUILTIN2_ARG_TEMPLATED'
  617 |         return __builtin_##NAME(static_cast(_Xx), static_cast(_Yx));                     \
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(93,1): note: expanded from here
   93 | __builtin_isunordered
      | ^
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:6:
In file included from C:\STL\out\x64\out\inc\random:13:
C:\STL\out\x64\out\inc\cmath(688,1): error: use of NaN is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  688 | _CLANG_BUILTIN2_TEMPLATED(isunordered)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(645,5): note: expanded from macro '_CLANG_BUILTIN2_TEMPLATED'
  645 |     _CLANG_BUILTIN2_ARG_TEMPLATED(NAME, short)              \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(617,16): note: expanded from macro '_CLANG_BUILTIN2_ARG_TEMPLATED'
  617 |         return __builtin_##NAME(static_cast(_Xx), static_cast(_Yx));                     \
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(97,1): note: expanded from here
   97 | __builtin_isunordered
      | ^
In file included from C:\STL\tests\std\tests\VSO_0000000_vector_algorithms_floats\test.cpp:6:
In file included from C:\STL\out\x64\out\inc\random:13:
C:\STL\out\x64\out\inc\cmath(688,1): error: use of NaN is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
  688 | _CLANG_BUILTIN2_TEMPLATED(isunordered)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(646,5): note: expanded from macro '_CLANG_BUILTIN2_TEMPLATED'
  646 |     _CLANG_BUILTIN2_ARG_TEMPLATED(NAME, int)                \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\STL\out\x64\out\inc\cmath(617,16): note: expanded from macro '_CLANG_BUILTIN2_ARG_TEMPLATED'
  617 |         return __builtin_##NAME(static_cast(_Xx), static_cast(_Yx));                     \
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(101,1): note: expanded from here
  101 | __builtin_isunordered
      | ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
--

#4932 will silence these warnings for the time being.

CaseyCarter avatar Sep 03 '24 22:09 CaseyCarter

I don't know what you would do about it other than suppression. /fp:fast is indeed asking for UB for NANs.

AlexGuteniev avatar Sep 05 '24 03:09 AlexGuteniev

I don't know what you would do about it other than suppression. /fp:fast is indeed asking for UB for NANs.

Ideally, we don't test undefined behavior. It tends to be unreliable. That could mean adding a macro to the /fp:fast configs that tells the tests to avoid problematic code. Or it could mean suppression, or it could mean not running those tests with /fp:fast.

CaseyCarter avatar Sep 05 '24 07:09 CaseyCarter

I see.

The whole point of separating VSO_0000000_vector_algorithms_floats from VSO_0000000_vector_algorithms was testing the cursed floating modes with the same exhaustive coverage as the standard /fp:precise mode.

Out of the cursed modes, /fp:fast is the main goal for testing, as it changes the control flow for the algorithm in question.

We can possibly drop infinities from /fp:fast coverage, that is, remove these elements: https://github.com/microsoft/STL/blob/c7c5ca7d6adde7c1554b1e52c0b97cb2a7f7ca60/tests/std/tests/VSO_0000000_vector_algorithms_floats/test.cpp#L33-L34

As for NANs. the test doesn't even try them in the standard /fp:precise mode. We've concluded that we don't support NANs in the sorting algorithms.

But most of these warnings (actually all quoted in the description) originate from <cmath> and <limits> headers. Need to suppress them in these headers!

AlexGuteniev avatar Sep 05 '24 08:09 AlexGuteniev

After one minute of my not-especially-clueful attempting during the weekly maintainer meeting, we weren't able to repro warnings from <limits> with a from-scratch source file. We should extract a minimal repro to understand exactly what about this test is continuing to emit Clang warnings. As usual, if merely including the header and doing not-risky things (like mentioning numeric_limits<double>::stuff() but not specifically inf/nan directly) emits a warning, then we should suppress it in the STL headers, but not if the user is asking us to do risky things on their behalf.

StephanTLavavej avatar Sep 11 '24 21:09 StephanTLavavej

When NaN and Inf are not properly supported, should we make the corresponding function return 0.0 and has_* give false?

frederick-vs-ja avatar Sep 29 '24 05:09 frederick-vs-ja

When NaN and Inf are not properly supported, should we make the corresponding function return 0.0 and has_* give false?

I don't think so. Something still works with NaN and Inf as expected even in /fp:fast.

AlexGuteniev avatar Sep 29 '24 06:09 AlexGuteniev

As usual, if merely including the header and doing not-risky things (like mentioning numeric_limits<double>::stuff() but not specifically inf/nan directly) emits a warning, then we should suppress it in the STL headers, but not if the user is asking us to do risky things on their behalf.

I've verified that it's the case (although for libc++ with #pragma GCC system_header removed; Godbolt link).

frederick-vs-ja avatar Sep 29 '24 06:09 frederick-vs-ja