Repository navigation
Suppress lifetime-safety-return-stack-addr-moved from clang 23, not 24 - #118005
alexey-milovidov merged 2 commits into
Conversation
The suppression was gated on clang 24 on the assumption that nothing below it
emits the diagnostic. Clang 23 emits it, so a build with clang 23 fails: the
warning is on by default, `WERROR` is on by default, and
`src/Parsers/Prometheus/PrometheusQueryTree.cpp:165` trips it ten times, once per
template instantiation.
error: stack memory associated with local variable 'new_node' may be returned
later. This could be a false positive as the storage may have been moved.
[-Werror,-Wlifetime-safety-return-stack-addr-moved]
The three related `lifetime-safety` diagnostics are already gated on 23 and are
suppressed correctly; only this one is not, so the compile command carries
`-Wno-lifetime-safety-intra-tu-suggestions`,
`-Wno-lifetime-safety-cross-tu-suggestions` and
`-Wno-lifetime-safety-invalidation` but not this one.
Nothing about the code is wrong - the `unique_ptr` payload is on the heap and
outlives the local, which the comment already says. Lower the gate to match the
compiler that actually emits it, and drop the stale note about clang 24 being
Emscripten-only.
|
Workflow [PR], commit [17b5613] Summary: ✅
AI ReviewSummaryThis PR lowers the suppression gate for Missing context / blind spots
Final Verdict✅ No findings. I would approve this as a targeted fix to the warning gate. LLVM Coverage ReportMeasured on commit 17b5613.
Changed lines: Uncovered code analysis did not run: No coverable C/C++ source files changed (contrib/ is excluded from coverage). Newly covered: +821 lines in 213 files (-938 lines lost coverage) · Details |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline. |
|
I dug up where the 24 came from before opening this —
No argument with the convention, just with the number. Clang 23 emits this one too. Building master with Homebrew clang 23 on macOS: Same idiom you described — pointer out of a Couple of caveats. This doesn't affect CI at all — that's on clang 22 and never sees the diagnostic, so it only helps local clang 23 builds. And I assumed 23 is supported because those three neighbours are gated there; if that's not the case, say so and I'll close it. @alexey-milovidov you wrote the gate and the comment — any reason not to move it to 23? Emscripten links 24, so it stays suppressed there either way. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed the build with clang 23, which failed on a
lifetime-safetydiagnostic whose suppression was gated one major version too high.Documentation entry for user-facing changes
cmake/warnings.cmakegates the suppression oflifetime-safety-return-stack-addr-movedon clang >= 24, on the assumption that nothing below that emits it. Clang 23 emits it, and since the warning is on by default andWERRORis on by default, the build fails:ten times, once per template instantiation. The three related
lifetime-safetydiagnostics immediately above are already gated on 23 and suppressed correctly, so the compile command carries-Wno-lifetime-safety-intra-tu-suggestions,-Wno-lifetime-safety-cross-tu-suggestionsand-Wno-lifetime-safety-invalidation- but not this one.Nothing about the code is wrong: the
unique_ptrpayload is on the heap and outlives the local, which the existing comment already explains. Only the version gate is off by one.Verified by A/B on the same file and compiler (Homebrew clang 23.1.0, macOS arm64,
CMAKE_BUILD_TYPE=Release):VERSION_GREATER_EQUAL 24(current)VERSION_GREATER_EQUAL 23(this PR)With the change, a full native build completes: 15074/15075 targets, no failures, working binary.
This is reachable today rather than hypothetical - Homebrew's default
llvmis currently 23.1.0, so a fresh native macOS build hits it. A box with clang 22 builds fine, which bounds the problem to clang 23 exactly.I also dropped the now-stale note saying clang 24 is only reached by the Emscripten build, since that assumption is what put the gate one version too high.
Minor: this leaves two consecutive blocks with the same
VERSION_GREATER_EQUAL 23condition. I kept the diff to one line rather than merging them, but happy to merge if you prefer.Workflow [PR]
Sync PR [sync-upstream/pr/118005]
Version info
26.9.1.1365(included in26.9and later)