From 9e303c5a6b99c94aad5bb31b3ecdc738d0933a67 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 22 Sep 2021 17:11:32 +0200 Subject: [PATCH 1/4] Check STL build in wxMSW cross-compile CI workflow Use --enable-stl for one of the builds (and also --disable-compat30 just to test it too) to check that wxMSW compiles correctly in STL mode too. --- .github/workflows/ci_msw_cross.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_msw_cross.yml b/.github/workflows/ci_msw_cross.yml index 0edc18c01e..7da87aca47 100644 --- a/.github/workflows/ci_msw_cross.yml +++ b/.github/workflows/ci_msw_cross.yml @@ -58,9 +58,12 @@ jobs: matrix: include: - name: wxMSW 64 bits + configure_flags: --enable-stl --disable-compat30 - name: wxMSW 32 bits triplet: i686-w64-mingw32 env: + wxCONFIGURE_FLAGS: ${{ matrix.configure_flags }} + # Default to 64-bit build. HOST_TRIPLET: ${{ matrix.triplet || 'x86_64-w64-mingw32' }} @@ -144,7 +147,7 @@ jobs: - name: Configure run: | - ./configure --host=${HOST_TRIPLET} --disable-sys-libs --disable-optimise --disable-debug_info || rc=$? + ./configure --host=${HOST_TRIPLET} --disable-sys-libs --disable-optimise --disable-debug_info $wxCONFIGURE_FLAGS || rc=$? if [ -n "$rc" ]; then echo '*** Configuring failed, contents of config.log follows: ***' From 4713c19b372cbe9abb08433093ea40e965bdb758 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 23 Sep 2021 16:47:13 +0200 Subject: [PATCH 2/4] Use STL in one of MSVS CI builds Do (almost) the same thing done in appveyor.yml to change wxUSE_STL value in setup.h. --- .github/workflows/ci_msw.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/ci_msw.yml b/.github/workflows/ci_msw.yml index b322809307..e61dbf7ace 100644 --- a/.github/workflows/ci_msw.yml +++ b/.github/workflows/ci_msw.yml @@ -58,6 +58,7 @@ jobs: - configuration: 'DLL Release' platform: 'x64' vsversion: 2019 + use_stl: true steps: - name: Checkout @@ -65,6 +66,15 @@ jobs: with: submodules: 'recursive' + - name: Configure to use STL + if: matrix.use_stl + working-directory: include/wx/msw + run: | + $txt = Get-Content setup.h + Write-Output $txt | + %{$_ -replace "define wxUSE_STL 0", "define wxUSE_STL 1"} | + Set-Content setup.h + - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@v1.0.3 with: From 168c6d3bd5fbb6e3e7f8961be1eadf91fb6a8f91 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 23 Sep 2021 18:13:25 +0200 Subject: [PATCH 3/4] Use STL in one of Mac builds too Check that Mac-specific code compiles and works correctly in STL builds too. --- .github/workflows/ci_mac.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_mac.yml b/.github/workflows/ci_mac.yml index 75a2a10a0b..1f40159a01 100644 --- a/.github/workflows/ci_mac.yml +++ b/.github/workflows/ci_mac.yml @@ -73,10 +73,10 @@ jobs: fail-fast: false matrix: include: - - name: wxMac ARM C++11 + - name: wxMac ARM C++11 STL runner: self-hosted arch: arm64 - configure_flags: --with-cxx=11 + configure_flags: --with-cxx=11 --enable-stl use_asan: true - name: wxMac Intel C++17 runner: self-hosted From 11b8276cc4abb3c85d198251b9396faf8fab350d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 11 Jan 2022 15:33:16 +0100 Subject: [PATCH 4/4] Disable container overflow detection in Mac STL ASAN CI build This seems to result in a false positive in BitmapComboBoxTestCase with the following stack: ERROR: AddressSanitizer: container-overflow on address 0x00010d5331c0 at pc 0x00010743e1e8 bp 0x00016b6f8940 sp 0x00016b6f8938 WRITE of size 8 at 0x00010d5331c0 thread T0 #0 0x10743e1e4 in wxString::ConvertedBuffer::ConvertedBuffer() string.h:3598 #1 0x10743ddbc in wxString::ConvertedBuffer::ConvertedBuffer() string.h:3598 #2 0x10743f49c in wxString::wxString(wxString const&) string.h:1157 #3 0x1074324ac in wxString::wxString(wxString const&) string.h:1157 #4 0x10747a4c4 in void std::__1::allocator::construct(wxString*, wxString const&) memory:916 #5 0x10747a3f8 in void std::__1::allocator_traits >::construct(std::__1::allocator&, wxString*, wxString const&) allocator_traits.h:288 #6 0x107479e2c in std::__1::vector >::__construct_at_end(unsigned long, wxString const&) vector:1063 #7 0x107479b3c in std::__1::vector >::insert(std::__1::__wrap_iter, unsigned long, wxString const&) vector:1889 #8 0x10756085c in wxBaseArray >::Insert(wxString, unsigned long, unsigned long) dynarray.h:181 #9 0x108028fbc in wxVListBoxComboPopup::Insert(wxString const&, int) odcombo.cpp:539 #10 0x108030180 in wxOwnerDrawnComboBox::DoInsertItems(wxArrayStringsAdapter const&, unsigned int, void**, wxClientDataType) odcombo.cpp:1122 #11 0x10826d690 in wxBitmapComboBox::DoInsertItems(wxArrayStringsAdapter const&, unsigned int, void**, wxClientDataType) bmpcboxg.cpp:169 #12 0x10485271c in wxItemContainer::InsertItems(wxArrayStringsAdapter const&, unsigned int, void**, wxClientDataType) ctrlsub.h:160 #13 0x1048522a0 in wxItemContainer::InsertItems(wxArrayStringsAdapter const&, unsigned int) ctrlsub.h:165 #14 0x10483c08c in wxItemContainer::Insert(wxArrayString const&, unsigned int) ctrlsub.h:247 #15 0x10483dac8 in ItemContainerTestCase::Count() itemcontainertest.cpp:96 #16 0x104866e04 in BitmapComboBoxTestCase::runTest() bitmapcomboboxtest.cpp:50 ... 0x00010d5331c0 is located 64 bytes inside of 160-byte region [0x00010d533180,0x00010d533220) allocated by thread T0 here: #0 0x105546714 in wrap__Znwm+0x74 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x4a714) #1 0x10747ae10 in void* std::__1::__libcpp_operator_new(unsigned long) new:235 #2 0x10747ad6c in std::__1::__libcpp_allocate(unsigned long, unsigned long) new:261 #3 0x10747ace8 in std::__1::allocator::allocate(unsigned long) memory:870 #4 0x10747ab88 in std::__1::allocator_traits >::allocate(std::__1::allocator&, unsigned long) allocator_traits.h:260 #5 0x10747aac4 in std::__1::__split_buffer&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator&) __split_buffer:314 #6 0x10747a110 in std::__1::__split_buffer&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator&) __split_buffer:313 #7 0x107479c30 in std::__1::vector >::insert(std::__1::__wrap_iter, unsigned long, wxString const&) vector:1904 #8 0x10756085c in wxBaseArray >::Insert(wxString, unsigned long, unsigned long) dynarray.h:181 #9 0x108028fbc in wxVListBoxComboPopup::Insert(wxString const&, int) odcombo.cpp:539 #10 0x108030180 in wxOwnerDrawnComboBox::DoInsertItems(wxArrayStringsAdapter const&, unsigned int, void**, wxClientDataType) odcombo.cpp:1122 #11 0x10826d690 in wxBitmapComboBox::DoInsertItems(wxArrayStringsAdapter const&, unsigned int, void**, wxClientDataType) bmpcboxg.cpp:169 #12 0x1075590bc in wxItemContainer::DoAppendItems(wxArrayStringsAdapter const&, void**, wxClientDataType) ctrlsub.h:352 #13 0x10484c9e0 in wxItemContainer::AppendItems(wxArrayStringsAdapter const&, void**, wxClientDataType) ctrlsub.h:117 #14 0x10484c8d4 in wxItemContainer::AppendItems(wxArrayStringsAdapter const&) ctrlsub.h:122 #15 0x10483999c in wxItemContainer::Append(wxArrayString const&) ctrlsub.h:209 #16 0x10483ccfc in ItemContainerTestCase::Count() itemcontainertest.cpp:82 #17 0x104866e04 in BitmapComboBoxTestCase::runTest() bitmapcomboboxtest.cpp:50 ... --- .github/workflows/ci_mac.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_mac.yml b/.github/workflows/ci_mac.yml index 1f40159a01..fb8fe5c64b 100644 --- a/.github/workflows/ci_mac.yml +++ b/.github/workflows/ci_mac.yml @@ -203,7 +203,11 @@ jobs: if: matrix.skip_testing != true working-directory: tests run: | - export ASAN_OPTIONS=fast_unwind_on_malloc=0 + # We currently need to disable container overflow detection as we get + # what seems to be a false positive in BitmapComboBoxTestCase triggered + # by creating a new string from std::allocator::construct() + # used by std::vector<>::insert(). + export ASAN_OPTIONS='fast_unwind_on_malloc=0 detect_container_overflow=0' # Exclude tests that are currently known to fail wx_tests_selection='~[valnum] ~wxPersistTLW ~wxPersistDVC ~wxTopLevel::Show ~wxFont::Weight ~wxFont::NativeFontInfo ~WebView ~RadioButton::Single ~RadioButton::Focus ~wxHtmlPrintout::Pagination ~ChoiceTestCase ~ComboBoxTestCase ~CheckListBoxTestCase ~ListBoxTestCase ~RearrangeListTestCase ~wxTextCtrl::GetBestSize ~TextCtrlTestCase ~ClippingBoxTestCase::wxClientDC ~wxExecute::RedirectUTF8 ~Ellipsization::NormalCase ~SpinCtrl::* ~SpinCtrlDouble::* ~NotebookTestCase ~SettingsTestCase ~XRC::LoadURL ~Window::Show ~ModalDialogsTestCase ~Button::Click ~Button::Disabled ~wxDVC::GetItemRect ~wxDVC::AppendTextColumn ~Grid::KeyboardSelection ~Grid::CellClick ~Grid::ReorderedColumnsCellClick ~Grid::CellSelect ~wxStyledTextCtrl::AutoComp ~EvtLoopTestCase ~EventPropagationTestCase' ./test_gui $wx_tests_selection