Skip to content

Commit 3593750

Browse files
authored
Merge pull request #238 from cmazakas/feature/sanitizers
CI Sanitizers
2 parents 31f98f2 + 4f4c729 commit 3593750

File tree

3 files changed

+56
-4
lines changed

3 files changed

+56
-4
lines changed

.github/workflows/ci.yml

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
pull_request:
1414
release:
1515
types: [published, created, edited]
16+
17+
env:
18+
UBSAN_OPTIONS: print_stacktrace=1
19+
1620
jobs:
1721
ubuntu-jammy:
1822
runs-on: ubuntu-22.04
@@ -60,7 +64,7 @@ jobs:
6064
run: ../../../b2 print_config_info toolset=$TOOLSET
6165
working-directory: ../boost-root/libs/config/test
6266
- name: Test
63-
run: ../../../b2 toolset=$TOOLSET
67+
run: ../../../b2 toolset=$TOOLSET variant=debug,release ${{ startsWith(matrix.compiler, 'g++-13') && 'address-sanitizer=norecover undefined-sanitizer=norecover' || '' }}
6468
working-directory: ../boost-root/libs/regex/test
6569
ubuntu-jammy-standalone:
6670
runs-on: ubuntu-22.04
@@ -170,6 +174,54 @@ jobs:
170174
- name: Test
171175
run: CXX=clang++-18 LIBRARIES="-licuuc -licudata -licui18n" ./test_clang.sh
172176
working-directory: ../boost-root/libs/regex/test/module
177+
ubuntu-noble-clang:
178+
runs-on: ubuntu-24.04
179+
strategy:
180+
fail-fast: false
181+
matrix:
182+
compiler: [ clang++-16, clang++-17, clang++-18 ]
183+
standard: [ c++11, c++14, c++17, c++20 ]
184+
steps:
185+
- uses: actions/checkout@v2
186+
with:
187+
fetch-depth: '0'
188+
- uses: mstachniuk/ci-skip@v1
189+
with:
190+
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE]'
191+
commit-filter-separator: ';'
192+
fail-fast: true
193+
- name: Set TOOLSET
194+
run: echo ${{ matrix.compiler }} | awk '/^g/ { print "TOOLSET=gcc" } /^clang/ { print "TOOLSET=clang" }' >> $GITHUB_ENV
195+
- name: Add repository
196+
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
197+
- name: Install packages
198+
run: sudo apt install clang-16 clang-17 clang-18
199+
- name: Checkout main boost
200+
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
201+
- name: Update tools/boostdep
202+
run: git submodule update --init tools/boostdep
203+
working-directory: ../boost-root
204+
- name: Copy files
205+
run: cp -r $GITHUB_WORKSPACE/* libs/regex
206+
working-directory: ../boost-root
207+
- name: Install deps
208+
run: python tools/boostdep/depinst/depinst.py -I example -g "--jobs 3" regex
209+
working-directory: ../boost-root
210+
- name: Bootstrap
211+
run: ./bootstrap.sh
212+
working-directory: ../boost-root
213+
- name: Generate headers
214+
run: ./b2 headers
215+
working-directory: ../boost-root
216+
- name: Generate user config
217+
run: 'echo "using $TOOLSET : : ${{ matrix.compiler }} : <cxxflags>-std=${{ matrix.standard }} ;" > ~/user-config.jam'
218+
working-directory: ../boost-root
219+
- name: Config info
220+
run: ../../../b2 print_config_info toolset=$TOOLSET
221+
working-directory: ../boost-root/libs/config/test
222+
- name: Test
223+
run: ../../../b2 toolset=$TOOLSET define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER variant=debug,release ${{ startsWith(matrix.compiler, 'clang++-18') && 'address-sanitizer=norecover undefined-sanitizer=norecover' || '' }}
224+
working-directory: ../boost-root/libs/regex/test
173225
macos:
174226
runs-on: macos-latest
175227
strategy:

include/boost/regex/v5/match_flags.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ BOOST_REGEX_MODULE_EXPORT inline match_flags operator|(match_flags m1, match_fla
101101
BOOST_REGEX_MODULE_EXPORT inline match_flags operator^(match_flags m1, match_flags m2)
102102
{ return static_cast<match_flags>(static_cast<std::int32_t>(m1) ^ static_cast<std::int32_t>(m2)); }
103103
BOOST_REGEX_MODULE_EXPORT inline match_flags operator~(match_flags m1)
104-
{ return static_cast<match_flags>(~static_cast<std::int32_t>(m1)); }
104+
{ return static_cast<match_flags>(~static_cast<std::int32_t>(m1) & static_cast<std::int32_t>(match_not_any)); }
105105
BOOST_REGEX_MODULE_EXPORT inline match_flags& operator&=(match_flags& m1, match_flags m2)
106106
{ m1 = m1&m2; return m1; }
107107
BOOST_REGEX_MODULE_EXPORT inline match_flags& operator|=(match_flags& m1, match_flags m2)

include/boost/regex/v5/perl_matcher_non_recursive.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ void perl_matcher<BidiIterator, Allocator, traits>::extend_stack()
237237
saved_state* backup_state;
238238
stack_base = static_cast<saved_state*>(get_mem_block());
239239
backup_state = reinterpret_cast<saved_state*>(reinterpret_cast<char*>(stack_base)+BOOST_REGEX_BLOCKSIZE);
240-
saved_extra_block* block = static_cast<saved_extra_block*>(backup_state);
241-
--block;
240+
saved_extra_block* block = reinterpret_cast<saved_extra_block*>(
241+
reinterpret_cast<std::uintptr_t>(backup_state) - sizeof(saved_extra_block));
242242
(void) new (block) saved_extra_block(m_stack_base, m_backup_state);
243243
m_stack_base = stack_base;
244244
m_backup_state = block;

0 commit comments

Comments
 (0)