Skip to content

ci: add libc++ hardening, libstdc++ assertions, and UBSan - #6310

Open
henryiii wants to merge 1 commit into
pybind:masterfrom
henryiii:ci/hardening-ubsan
Open

henryiii wants to merge 1 commit into
pybind:masterfrom
henryiii:ci/hardening-ubsan

Conversation

@henryiii

Copy link
Copy Markdown
Collaborator

🤖 AI text below 🤖

Description

Adds standard library and undefined-behavior checks to existing CI jobs:

  • macOS 3.14 (C++14) and 3.14t (C++20): _LIBCPP_HARDENING_MODE_DEBUG.
  • GCC 13: _GLIBCXX_ASSERTIONS and -fsanitize=undefined -fno-sanitize-recover=all. UBSan is on GCC because GCC links the UBSan runtime into shared modules, so no preload is needed.

UBSan found two misaligned references:

I ran these configurations locally: libc++ hardening with Apple clang, UBSan with Apple clang, and the GCC 13 job in Docker with the same flags.

Two macOS jobs use libc++ debug hardening. The GCC 13 job uses
_GLIBCXX_ASSERTIONS and UBSan. It deselects one at() test that reads a
misaligned reference (pybind#6309).

Fix a test that bound a reference to a member of a packed struct.

Assisted-by: ClaudeCode:claude-opus-5-5
@henryiii
henryiii marked this pull request as ready for review November 25, 2026 05:05

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant