Clang RelWithDebInfo builds with assertions enabled (missing -DNDEBUG)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- cmake, cpp
- Domain
- build-system
Research direction
Start with cmake/compiler_flags/Clang.CXX.cmake and compare its CMAKE_CXX_FLAGS_RELWITHDEBINFO setting with cmake/compiler_flags/GNU.CXX.cmake. Configure a Clang RelWithDebInfo build and inspect build/*/compile_commands.json; done when the compile commands include -DNDEBUG. The coverage flags and warning-set inconsistencies are adjacent optional work, so confirm whether they are in scope.
Written by the indexing model from the issue text.
Description
🤖 AI text below 🤖
What
cmake/compiler_flags/Clang.CXX.cmake:24-28 overwrites CMAKE_CXX_FLAGS_RELWITHDEBINFO with a flag
set that defines DEBUG and, crucially, does not define NDEBUG:
set(
CMAKE_CXX_FLAGS_RELWITHDEBINFO
"-O3 -g3 -DDEBUG -glldb -fno-limit-debug-info"
)
cmake/compiler_flags/GNU.CXX.cmake gets this right:
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g3 -DNDEBUG")
Because the variable is overwritten rather than appended to, CMake's own default (which supplies
-DNDEBUG) is discarded.
Why this is a problem
Under Clang, RelWithDebInfo is an -O3 build with every assert live. Several sit on hot
paths:
cpp/monoprop/detail/operator/InvertedIndex.h, infill_rows:
This runs for allassert(col.is_dense || std::ranges::is_sorted(col.set_rows));2 * NumModescolumns on everyfill_rowscall, turning an O(new rows) append
into O(columns × total rows) — so the cost per gate grows with the whole operator instead of with
the newly inserted terms.cpp/monoprop/detail/evolution/layer_build/Scan.h(thefused_scale_coeffsaliasing assert) and
cpp/monoprop/detail/evolution/layer_build/Engine.h.
The flag set also carries -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer, i.e. this is
precisely the configuration someone reaches for when profiling. Any profile taken from a Clang
RelWithDebInfo build is currently measuring the assertions.
Suggested fix
Use -DNDEBUG in Clang's RelWithDebInfo, matching the GNU file:
set(
CMAKE_CXX_FLAGS_RELWITHDEBINFO
"-O3 -g3 -DNDEBUG -glldb -fno-limit-debug-info"
)
Two adjacent inconsistencies in the same file, worth folding in or splitting out as preferred:
Clang.CXX.cmakedefines noCMAKE_CXX_FLAGS_COVERAGE, whileGNU.CXX.cmakedoes
(-O1 --coverage -g)..github/workflows/qa-analysis.ymlsets
SKBUILD_CMAKE_BUILD_TYPE: "Coverage", so a Clang leg of that job would build with no flags at all.- The Clang warning set is materially weaker than the GNU one:
-Wextra,-Wconversion,
-Wcast-align,-Wnon-virtual-dtorand-Wunused-parameterare GCC-only today.
Verification
Configure a Clang RelWithDebInfo tree and confirm NDEBUG appears in
build/*/compile_commands.json.
Found by a code-reading review of the repository at 29a8050. No build tree was available, so the
analysis is from source inspection and should be confirmed against a build.
- Dominant language
- C++
- Stars
- 52
- Forks
- 2
- Avg merge
- 22h 23m
- Merged PRs (30d)
- 36
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Algorithmiq/monoprop
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Algorithmiq/monoprop#193 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Algorithmiq/monoprop#192 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Algorithmiq/monoprop#189 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 72/100
Algorithmiq/monoprop#392 ·
Maintainers usually reply within 1 day
-
Documentation webpage per version, with version selectorMay be free again @matteoacrossi claimed this 44 days ago, and no pull request is open. Opendocumentation enhancement
Algorithmiq/monoprop#289 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
All issues in Algorithmiq/monoprop
Similar issues
-
Component: Python API
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Vector35/binaryninja-api#8649 ·
Maintainers usually reply within 3 days
-
ai_p2 comp-parquet-reader-v3
Difficulty 2/5 Half a day Newbie friendliness 66/100
ClickHouse/ClickHouse#124986 ·
Maintainers usually reply within 1 day
-
bug product: very_good_flutter_plugin
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
VeryGoodOpenSource/very_good_templates#654 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
AcademySoftwareFoundation/OpenImageIO#5550 ·
Maintainers usually reply within 2 days