Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable ubsan #3452

Merged
merged 22 commits into from
Mar 13, 2023
Merged

enable ubsan #3452

merged 22 commits into from
Mar 13, 2023

Conversation

fsb4000
Copy link
Contributor

@fsb4000 fsb4000 commented Feb 12, 2023

It works only with /MT

@fsb4000 fsb4000 requested a review from a team as a code owner February 12, 2023 13:42
@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 12, 2023

Command: "C:\Dev\STL\out\build\x64\tests\std\tests\VSO_0000000_regex_interface\Output\28\VSO_0000000_regex_interface.exe"
Exit Code: 1
Standard Error:
--
C:\Dev\STL\out\build\x64\out\inc\regex:4314:9: runtime error: load of value 1082, which is not a valid value for type 'std::_Meta_type'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Dev\STL\out\build\x64\out\inc\regex:4314:9 in
Command: "C:\Dev\STL\out\build\x64\tests\std\tests\P0408R7_efficient_access_to_stringbuf_buffer\Output\18\P0408R7_efficient_access_to_stringbuf_buffer.exe"
Exit Code: 1
Standard Output:
--
running normal tests...--
Standard Error:
--
C:\Dev\STL\out\build\x64\out\inc\streambuf:197:25: runtime error: applying non-zero offset 14701096 to null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Dev\STL\out\build\x64\out\inc\streambuf:197:25 in
Command: "C:\Dev\STL\out\build\x64\tests\tr1\tests\sstream1\Output\27\sstream1.exe"
Exit Code: 1
Standard Error:
--
C:\Dev\STL\out\build\x64\out\inc\streambuf:197:25: runtime error: applying non-zero offset 10045448 to null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Dev\STL\out\build\x64\out\inc\streambuf:197:25 in
Command: "C:\Dev\STL\out\build\x64\tests\tr1\tests\cstddef\Output\27\cstddef.exe"
Exit Code: 1
Standard Error:
--
C:\Dev\STL\tests\tr1\tests\cstddef\test.cpp:26:40: runtime error: applying non-zero offset 2147483647 to null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Dev\STL\tests\tr1\tests\cstddef\test.cpp:26:40 in
Command: "C:\Dev\STL\out\build\x64\tests\tr1\tests\sstream2\Output\27\sstream2.exe"
Exit Code: 1
Standard Error:
--
C:\Dev\STL\out\build\x64\out\inc\sstream:483:52: runtime error: reference binding to null pointer of type 'wchar_t'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Dev\STL\out\build\x64\out\inc\sstream:483:52 in
Command: "C:\Dev\STL\out\build\x64\tests\tr1\tests\type_traits5\Output\27\type_traits5.exe"
Exit Code: 1
Standard Error:
--
C:\Dev\STL\tests\tr1\tests\type_traits5\test.cpp:198:5: runtime error: load of value -3, which is not a valid value for type 'color'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Dev\STL\tests\tr1\tests\type_traits5\test.cpp:198:5 in

@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 12, 2023

Can we know what test is still running?

And was some behaviour intended?
For example:

typedef enum { red, blue, green } color;

color neg = (color) (-3);
CHECK_INT((STD make_signed<color>::type)(neg), neg);

@fsb4000 fsb4000 marked this pull request as draft February 12, 2023 14:26
@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 12, 2023

ubsan has some options: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#available-checks

-fsanitize=undefined: All of the checks listed above other than float-divide-by-zero, unsigned-integer-overflow, implicit-conversion, local-bounds and the nullability-* group of checks.

@StephanTLavavej StephanTLavavej added the test Related to test code label Feb 12, 2023
@frederick-vs-ja
Copy link
Contributor

frederick-vs-ja commented Feb 13, 2023

C:\Dev\STL\out\build\x64\out\inc\regex:4314:9: runtime error: load of value 1082, which is not a valid value for type 'std::_Meta_type'

C:\Dev\STL\tests\tr1\tests\type_traits5\test.cpp:198:5: runtime error: load of value -3, which is not a valid value for type 'color'

These case are made undefined by CWG-1766, see [dcl.enum]/8 and [expr.static.cast]/10.


typedef enum { red, blue, green } color;

In this file, I believe it's better to add fixed underlying type int to color.


STL/stl/inc/regex

Lines 3799 to 3805 in 9ae1b3f

if (_Pat == _End) {
_Mchar = _Meta_eos;
_Char = static_cast<_Elem>(_Meta_eos);
} else { // map current character
_Char = *_Pat;
_Mchar = _CSTD strchr(_Meta_map, _Char) ? static_cast<_Meta_type>(_Char) : _Meta_chr;
}

IIUC the valid values of _Meta_type are integer values in [-128, 127]. So static_cast a wchar_t value (L'к' in the failing case) to _Meta_type can sometimes be UB.
Perhaps a suitable fix is also adding fixed underlying type int to _Meta_type, but I'm not sure.

@frederick-vs-ja
Copy link
Contributor

STDx ptrdiff_t pdiff = &pc[INT_MAX] - &pc[0];

C:\Dev\STL\tests\tr1\tests\cstddef\test.cpp:26:40: runtime error: applying non-zero offset 2147483647 to null pointer

This line (and line 32) has UB (invalid pointer arithmetic). I think we should perform pointer arithmetic on offs instead.


_Al.deallocate(_Ptr_traits::pointer_to(*_Mysb::eback()),

C:\Dev\STL\out\build\x64\out\inc\sstream:483:52: runtime error: reference binding to null pointer of type 'wchar_t'

Likely dereferenced _Mysb::eback() when it was null. IMO we should just not enter the branch.

@frederick-vs-ja
Copy link
Contributor

_Mysb::setg(_Newptr, nullptr, _Newptr);

C:\Dev\STL\out\build\x64\out\inc\streambuf:197:25: runtime error: applying non-zero offset 14701096 to null pointer

C:\Dev\STL\out\build\x64\out\inc\streambuf:197:25: runtime error: applying non-zero offset 10045448 to null pointer

Passing nullptr as the second argument is probably wrong - all the 3 pointers should point to the same sequence (or all null). Perhaps the seconde argument should be _Newptr.

Co-authored-by: A. Jiang <de34@live.cn>
@fsb4000 fsb4000 marked this pull request as ready for review February 13, 2023 22:34
@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 13, 2023

Thank you for your analysis!

I think we should perform pointer arithmetic on offs instead.

C:\Dev\STL\tests\tr1\tests\cstddef\test.cpp(26,40): error: array index 2147483647 is past the end of the array (which contains 3 elements) [-Werror,-Warray-bounds]
    STDx ptrdiff_t pdiff            = &offs[INT_MAX] - &offs[0];
                                       ^    ~~~~~~~
C:\Dev\STL\tests\tr1\tests\cstddef\test.cpp(25,5): note: array 'offs' declared here
    static const STDx size_t offs[] = {offsetof(Str, f1), offsetof(Str, f2), offsetof(Str, f3)};
    ^

but it works with ps

@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 14, 2023

I remembered #2121 :)

@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 14, 2023

X86 failing tests

Command: "C:\Dev\STL\out\build\x86\tests\std\tests\Dev11_0235721_async_and_packaged_task\Output\26\Dev11_0235721_async_and_packaged_task.exe"
Exit Code: 1
Standard Error:
--
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32213\include\ppltasks.h:3541:144: runtime error: constructor call on misaligned address 0x025ef6d4 for type 'std::function<void ()>', which requires 8 byte alignment
0x025ef6d4: note: pointer points here
  82 87 7d 00 f4 ed 97 00  f2 88 7d 00 64 5b 8a 00  80 27 7a 00 20 f7 5e 02  e3 87 7d 00 ec ed 97 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32213\include\ppltasks.h:3541:144 in
--
Command: "C:\Dev\STL\out\build\x86\tests\std\tests\GH_002488_promise_not_default_constructible_types\Output\26\GH_002488_promise_not_default_constructible_types.exe"
Exit Code: 1
Standard Error:
--
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32213\include\ppltasks.h:3541:144: runtime error: constructor call on misaligned address 0x0253f6ec for type 'std::function<void ()>', which requires 8 byte alignment
0x0253f6ec: note: pointer points here
  88 c2 9b 00 84 9c 85 00  f8 c3 9b 00 e4 e9 a8 00  20 c0 96 00 38 f7 53 02  e9 c2 9b 00 7c 9c 85 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32213\include\ppltasks.h:3541:144 in
--
Command: "C:\Dev\STL\out\build\x86\tests\std\tests\P0024R2_parallel_algorithms_find_end\Output\26\P0024R2_parallel_algorithms_find_end.exe"
Exit Code: 1
Standard Error:
--
C:\Dev\STL\out\build\x86\out\inc\forward_list:282:53: runtime error: reference binding to misaligned address 0x00afe6bc for type 'std::_Flist_val<std::_Flist_simple_types<double>>::_Node' (aka 'std::_Flist_node<double, void *>'), which requires 8 byte alignment
0x00afe6bc: note: pointer points here
  60 aa b8 00 00 00 00 00  d4 e5 af 00 10 fc af 00  30 31 bb 00 ff ff ff ff  02 6a bf 00 e6 69 bf 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Dev\STL\out\build\x86\out\inc\forward_list:282:53 in
Command: "C:\Dev\STL\out\build\x86\tests\std\tests\Dev11_0000000_function_crashes\Output\28\Dev11_0000000_function_crashes.exe"
Exit Code: 1
Standard Error:
--
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32213\include\ppltasks.h:3541:144: runtime error: constructor call on misaligned address 0x0320f4f4 for type 'std::function<void ()>', which requires 8 byte alignment
0x0320f4f4: note: pointer points here
  3e 9b 52 00 9c 6d 56 01  ae 9c 52 00 e4 91 5c 00  a0 88 50 00 40 f5 20 03  9f 9b 52 00 94 6d 56 01
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32213\include\ppltasks.h:3541:144 in
Command: "C:\Dev\STL\out\build\x86\tests\std\tests\P1135R6_atomic_wait\Output\18\P1135R6_atomic_wait.exe"
Exit Code: 1
Standard Error:
--
C:\Dev\STL\out\build\x86\out\inc\__msvc_chrono.hpp:302:16: runtime error: constructor call on misaligned address 0x00aff454 for type 'std::chrono::duration<long long, std::ratio<1, 1000000000>>', which requires 8 byte alignment
0x00aff454: note: pointer points here
  fc cc b3 00 a0 f4 af 00  b0 f4 af 00 90 f4 af 00  a0 f4 af 00 a8 f4 af 00  b0 f4 af 00 5c f4 af 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Dev\STL\out\build\x86\out\inc\__msvc_chrono.hpp:302:16 in
Command: "C:\Dev\STL\out\build\x86\tests\std\tests\P2322R6_ranges_alg_fold\Output\14\P2322R6_ranges_alg_fold.exe"
Exit Code: 1
Standard Error:
--
C:\Dev\STL\out\build\x86\out\inc\algorithm:2639:74: runtime error: load of misaligned address 0x011ef6fc for type 'remove_reference_t<double &>' (aka 'double'), which requires 8 byte alignment
0x011ef6fc: note: pointer points here
  f0 af 02 01 00 00 00 00  00 00 00 00 03 00 00 00  4c 00 5c 00 6f 00 75 00  74 00 5c 00 62 00 75 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Dev\STL\out\build\x86\out\inc\algorithm:2639:74 in
Command: "C:\Dev\STL\out\build\x86\tests\std\tests\Dev11_0377755_thread_ctor_move_only_types\Output\26\Dev11_0377755_thread_ctor_move_only_types.exe"
Exit Code: 1
Standard Error:
--
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32213\include\ppltasks.h:3541:144: runtime error: constructor call on misaligned address 0x030af9ac for type 'std::function<void ()>', which requires 8 byte alignment
0x030af9ac: note: pointer points here
  a5 95 be 00 9c 04 30 01  15 97 be 00 e4 b6 c9 00  00 83 bc 00 f8 f9 0a 03  06 96 be 00 94 04 30 01
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32213\include\ppltasks.h:3541:144 in
Command: "C:\Dev\STL\out\build\x86\tests\std\tests\GH_000431_copy_move_family\Output\28\GH_000431_copy_move_family.exe"
Exit Code: 1
Standard Error:
--
C:\Dev\STL\tests\std\tests\GH_000431_copy_move_family\test.cpp:486:45: runtime error: reference binding to misaligned address 0x0053eeec for type 'mfn_ptr[5]' (aka 'int (StatefulDerived::*[5])() __attribute__((thiscall))'), which requires 8 byte alignment
0x0053eeec: note: pointer points here
  18 04 19 04 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Dev\STL\tests\std\tests\GH_000431_copy_move_family\test.cpp:486:45 in
Command: "C:\Dev\STL\out\build\x86\tests\tr1\tests\streambuf1\Output\27\streambuf1.exe"
Exit Code: 1
Standard Error:
--
C:\Dev\STL\out\build\x86\out\inc\streambuf:214:25: runtime error: applying non-zero offset to non-null pointer 0x005cf8df produced null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Dev\STL\out\build\x86\out\inc\streambuf:214:25 in
--
Command: "C:\Dev\STL\out\build\x86\tests\std\tests\GH_002058_debug_iterator_race\Output\26\GH_002058_debug_iterator_race.exe"
Exit Code: 1
Standard Error:
--
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32213\include\ppltasks.h:3541:144: runtime error: constructor call on misaligned address 0x02ecf74c for type 'std::function<void ()>', which requires 8 byte alignment
0x02ecf74c: note: pointer points here
  be 91 99 00 5c 06 11 01  2e 93 99 00 24 3c a7 00  a0 7c 93 00 98 f7 ec 02  1f 92 99 00 54 06 11 01
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32213\include\ppltasks.h:3541:144 in
Command: "C:\Dev\STL\out\build\x86\tests\std\tests\P0024R2_parallel_algorithms_search\Output\26\P0024R2_parallel_algorithms_search.exe"
Exit Code: 1
Standard Error:
--
C:\Dev\STL\out\build\x86\out\inc\forward_list:282:53: runtime error: reference binding to misaligned address 0x005fe38c for type 'std::_Flist_val<std::_Flist_simple_types<double>>::_Node' (aka 'std::_Flist_node<double, void *>'), which requires 8 byte alignment
0x005fe38c: note: pointer points here
  d0 b1 eb 00 00 00 00 00  dc e2 5f 00 e0 f8 5f 00  e0 1a ee 00 ff ff ff ff  bc 4f f2 00 a0 4f f2 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Dev\STL\out\build\x86\out\inc\forward_list:282:53 in
--
Command: "C:\Dev\STL\out\build\x86\tests\std\tests\P1135R6_atomic_wait_vista\Output\18\P1135R6_atomic_wait_vista.exe"
Exit Code: 1
Standard Error:
--
C:\Dev\STL\out\build\x86\out\inc\__msvc_chrono.hpp:302:16: runtime error: constructor call on misaligned address 0x0053f5e4 for type 'std::chrono::duration<long long, std::ratio<1, 1000000000>>', which requires 8 byte alignment
0x0053f5e4: note: pointer points here
  e4 ce d3 00 30 f6 53 00  40 f6 53 00 20 f6 53 00  30 f6 53 00 38 f6 53 00  40 f6 53 00 ec f5 53 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Dev\STL\out\build\x86\out\inc\__msvc_chrono.hpp:302:16 in
Command: "C:\Dev\STL\out\build\x86\tests\std\tests\Dev11_1127004_future_has_exceptions_0\Output\53\Dev11_1127004_future_has_exceptions_0.exe"
Exit Code: 1
Standard Error:
--
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32213\include\ppltasks.h:3541:144: runtime error: constructor call on misaligned address 0x02e6f82c for type 'std::function<void ()>', which requires 8 byte alignment
0x02e6f82c: note: pointer points here
  20 73 d7 00 a4 6e f1 00  90 74 d7 00 a4 42 e1 00  20 62 d5 00 78 f8 e6 02  81 73 d7 00 9c 6e f1 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32213\include\ppltasks.h:3541:144 in
--
Command: "C:\Dev\STL\out\build\x86\tests\std\tests\VSO_0102478_moving_allocators\Output\28\VSO_0102478_moving_allocators.exe"
Exit Code: 1
Standard Error:
--
C:\Dev\STL\out\build\x86\out\inc\forward_list:282:53: runtime error: reference binding to misaligned address 0x00aff644 for type 'std::_Flist_val<std::_Flist_simple_types<double>>::_Node' (aka 'std::_Flist_node<double, void *>'), which requires 8 byte alignment
0x00aff644: note: pointer points here
  10 f7 af 00 00 00 00 00  74 f7 af 00 73 7f 41 00  74 f7 af 00 6c 65 00 00  00 00 00 00 50 f6 af 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Dev\STL\out\build\x86\out\inc\forward_list:282:53 in
--
Command: "C:\Dev\STL\out\build\x86\tests\tr1\tests\streambuf2\Output\27\streambuf2.exe"
Exit Code: 1
Standard Error:
--
C:\Dev\STL\out\build\x86\out\inc\streambuf:214:25: runtime error: applying non-zero offset to non-null pointer 0x0135fbde produced null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Dev\STL\out\build\x86\out\inc\streambuf:214:25 in
--

@frederick-vs-ja
Copy link
Contributor

frederick-vs-ja commented Feb 14, 2023

C:\Dev\STL\out\build\x86\out\inc\streambuf:214:25: runtime error: applying non-zero offset to non-null pointer 0x005cf8df produced null pointer

Mybase::setp(p, nullptr);

C:\Dev\STL\out\build\x86\out\inc\streambuf:214:25: runtime error: applying non-zero offset to non-null pointer 0x0135fbde produced null pointer

Mybase::setp(p, nullptr);

I think this 2 lines are doing evil, as the begin pointer may be set to non-null but end pointer is definitely set to null. They should be Mybase::setp(p, p);. (But why was this only diagnosed on x86?)


Alignment issues: see DevCom-294259. I guess it can't be fixed without ABI breakage.

Co-authored-by: A. Jiang <de34@live.cn>
@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 14, 2023

Mybase::setp(p, p); fixed the tests.
And we might run ubsan only on X64 for now.
Maybe @StephanTLavavej knows how we need to change the test matrices.

@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 16, 2023

Command: "C:\Dev\STL\out\build\x64\tests\tr1\tests\chrono\Output\22\chrono.exe"
Exit Code: 1
Standard Error:
--
C:\Dev\STL\tests\tr1\tests\chrono\test.cpp:57:9: runtime error: -1.79769e+308 is outside the range of representable values of type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior C:\Dev\STL\tests\tr1\tests\chrono\test.cpp:57:9 in

line: CHECK_INT(d_d::min(), STD numeric_limits<double>::lowest());
I changed CHECK_INT to CHECK_DOUBLE

@frederick-vs-ja
Copy link
Contributor

Maybe related: my current approach for #3469 (and ironically, my planned resolution for #2285) is introducing core UB. Perhaps we should run UBSan again after merging that PR.

@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 16, 2023

C:\Dev\STL\out\build\x64>    python tests\utils\stl-lit\stl-lit.py ..\..\..\tests\std\tests\LWG2309 -v
-- Testing: 1 tests, 1 workers --
PASS: std :: tests/LWG2309:0 (1 of 1)

Testing Time: 929.75s
  Passed: 1

I used this matrix and your test code and your branch.

commit fbfc328d9893e0a87125db04e7840df7f08685df (HEAD, frederick/lwg-2309)
Author: A. Jiang <de34@live.cn>
Date:   Thu Feb 16 17:20:58 2023 +0800

    Address @barcharcraz
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

RUNALL_INCLUDE .\prefix.lst
RUNALL_CROSSLIST
PM_CL="/w14640 /Zc:threadSafeInit- /EHsc /std:c++latest"
RUNALL_CROSSLIST
PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /permissive- /MT /fp:strict -fsanitize=undefined -fno-sanitize-recover=undefined"

command:

Command: "C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\Llvm\x64\bin\clang-cl.EXE" "C:\Dev\STL\tests\std\tests\LWG2309\test.cpp" "-IC:\Dev\STL\out\build\x64\out\inc" "-IC:\Dev\STL\llvm-project\libcxx\test\support" "-IC:\Dev\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" "/Zc:strictStrings" "/D_ENABLE_STL_INTERNAL_CHECK" "/bigobj" "/FIforce_include.hpp" "/w14365" "/D_ENFORCE_FACET_SPECIALIZATIONS=1" "/D_STL_CALL_ABORT_INSTEAD_OF_INVALID_PARAMETER" "/w14640" "/Zc:threadSafeInit-" "/EHsc" "/std:c++latest" "-fno-ms-compatibility" "-fno-delayed-template-parsing" "-Wno-unqualified-std-cast-call" "/permissive-" "/MT" "/fp:strict" "-fsanitize=undefined" "-fno-sanitize-recover=undefined" "-m64" "-FeC:\Dev\STL\out\build\x64\tests\std\tests\LWG2309\Output\0\LWG2309.exe" "-link" "-LIBPATH:C:\Dev\STL\out\build\x64\out\lib\amd64" "-LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32213\lib\x64" "/MANIFEST:EMBED"

@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 17, 2023

/pr review

@StephanTLavavej StephanTLavavej added bug Something isn't working decision needed We need to choose something before working on this labels Feb 17, 2023
@StephanTLavavej StephanTLavavej removed the decision needed We need to choose something before working on this label Feb 22, 2023
@StephanTLavavej
Copy link
Member

We talked about this at the weekly maintainer meeting and are (reluctantly) okay with enabling ubsan in the test coverage, unless and until sporadic or weird behavior appears.

@StephanTLavavej

This comment was marked as resolved.

tests/tr1/tests/type_traits5/test.cpp Outdated Show resolved Hide resolved
stl/inc/sstream Outdated Show resolved Hide resolved
tests/tr1/tests/cstddef/test.cpp Show resolved Hide resolved
@StephanTLavavej
Copy link
Member

StephanTLavavej commented Mar 8, 2023

Thanks! 😻 I pushed a merge with main to resolve simple merge conflicts involving the removal of the -Xclang option, followed by a couple of nitpicky cleanups (that I probably wouldn't have bothered with in the absence of the merge conflicts). I think that these changes are all improvements, and I don't see compatibility or test stability risks here.

The most significant impact is that this increases test cost by adding a new configuration to the matrices, but given the issues that this has found, it seems worth it.

⚠️ As @fsb4000 mentioned, changes to the internal Perl test harness will be necessary to restrict ubsan to x64. I believe this will involve pushing a change that affects the Perl scripts in this repo. Update: I ended up skipping ubsan entirely for the internal Perl test harness, no changes here necessary.

@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej
Copy link
Member

Thanks for improving test coverage and fixing these places where the STL and its tests were being bad kitties by jumping up on the table where they're not allowed! 😼 🚫 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working test Related to test code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants