Skip to content

Add -D_LIBCPP_ENABLE_ASSERTIONS=1 to ASAN/UBSAN CI configurations. #5340

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mxms0
Copy link

@mxms0 mxms0 commented Dec 13, 2022

-D_LIBCPP_ENABLE_ASSERTIONS=1 enables container checking for C++ STL types, like std::vector, std::string, and std::optional. Note, it does not do any validation for iterators. This should address #5245.

I suspect there will be many test failures here before this can be merged.

-D_LIBCPP_ENABLE_ASSERTIONS=1 enables container checking for C++ STL types,
like std::vector, std::string, and std::optional. Note, it does not do any
validation for iterators.
@kripken
Copy link
Member

kripken commented Dec 14, 2022

No errors! But do we need to actually use libc++ for them to have an effect? I think we use the default on CI, which might be libstdc++?

@mxms0
Copy link
Author

mxms0 commented Dec 14, 2022

Ah yeah, few things going on here. Indeed, LLVM Libc++ isn't installed, so it's not using that one. I went ahead and setup an Ubuntu 22.04 Linux VM to test if the LLVM LIbc++ it ships is even new enough, and it seems it's not.

mxms@test2:~$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

mxms@test2:~$ dpkg --list | grep libc++
ii  libc++-14-dev:amd64             1:14.0.0-1ubuntu1                       amd64        LLVM C++ Standard library (development files)
ii  libc++-dev:amd64                1:14.0-55~exp2                          amd64        LLVM C++ Standard library (development files)
ii  libc++1-14:amd64                1:14.0.0-1ubuntu1                       amd64        LLVM C++ Standard library
ii  libc++abi-14-dev:amd64          1:14.0.0-1ubuntu1                       amd64        LLVM low level support for a standard C++ library (development files)
ii  libc++abi-dev:amd64             1:14.0-55~exp2                          amd64        LLVM low level support for a standard C++ library (development files)
ii  libc++abi1-14:amd64             1:14.0.0-1ubuntu1                       amd64        LLVM low level support for a standard C++ library

GitHub Actions Ubuntu-latest is 20.04... so uh, not really sure what the best course of action is here. We can leave this change and wait until GitHub Actions and Ubuntu both upgrade, or we can run the tests locally with the asserts enabled and put them somewhere, or something else

Let me know your thoughts,
Max

@kripken
Copy link
Member

kripken commented Dec 14, 2022

If we think this can catch real bugs then it might be worth building libc++ from source on CI or another of the options you mention. However, I'm not sure how many bugs to expect it to find. Maybe as a first step you can test this locally and see if anything in the test suite fails for you?

@mxms0
Copy link
Author

mxms0 commented Dec 15, 2022

Yeah that's how I got here - I'll post some bugs here as soon as I get a second :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants