InsightSoftwareConsortium / InsightSoftwareConsortium/ITK

COMP: Nightly warning backlog — `-Wlifetime-safety-invalidation`, `-Wnrvo`, `-Waggressive-loop-optimizations`, `-Wallocator-wrappers`

Open
#6,737 0 comments 0 reactions 0 assignees View on GitHub
type:Compiler type:Infrastructure
Dominant language
C++
Stars
1.7k
Forks
748
Avg merge
1d 1h
Merged PRs (30d)
64

Description

After #6364 / #6365 / #6366 cleared the large nightly buckets, four smaller newer-compiler-specific warning clusters remain on CDash. Low priority — mostly bleeding-edge Clang diagnostics — but worth a dedicated pass.

Snapshot (20260530-0100 nightly, project Insight on open.cdash.org — counts drift, re-triage before acting)

Non-ThirdParty file counts:

| Flag | Warns | Files | Notes |
|------|------:|------:|-------|
| `-Wlifetime-safety-invalidation` | 40 | 14 | New Clang (ClangMain). SimplexMesh.h/.hxx, KdTreeBasedKmeansEstimator.h, StatisticsAlgorithm.hxx, NumericTraitsStdVector.h, MRIBiasFieldCorrectionFilter.h, itkPhilipsPAR.cxx, itkVTIImageIO.cxx, itkNrrdImageIO.cxx, StringTools.hxx, itkDOMNode.cxx |
| `-Wnrvo` | 11 | 7 | BSplineInterpolationWeightFunction.hxx, itkPhilipsRECImageIO.cxx, itkJPEG2000ImageIO.cxx, itkGiftiMeshIO.cxx, itkStreamingImageIOBase.cxx, ParametricPath.hxx, itkMultiThreaderBase.cxx |
| `-Waggressive-loop-optimizations` | 12 | 2 | GCC. itkESMDemonsRegistrationFunction.hxx, itkWarpImageFilter.hxx |
| `-Wallocator-wrappers` | 13 | 1 | itkImportImageContainer.hxx |
| `-Wlifetime-safety-use-after-free` | 1 | 1 | itkFixedArrayTest2.cxx |
| `-Wrange-loop-construct` | 3 | 1 | Modules/Remote/Cuberille (remote module) |

Dashboards where these dominate: `Mac26.x-ClangMain-dbg-arm64` and `Mac26.x-AppleClang-dbg-TSan` (199 warnings each), and `Ubuntu-22.04-gcc11.4` variants for `-Waggressive-loop-optimizations`.

**These numbers are a point-in-time snapshot (2026-05-30) and have not been re-derived.** Re-run triage for current counts.

Suggested triage order

1. Take a fresh snapshot first — the numbers drift nightly.
2. Work lowest-risk first:
- **`-Wnrvo`** — usually a stray `std::move` on a return value, or a `return x;` shape that defeats NRVO. Remove the move / restructure. Mechanical and safe.
- **`-Waggressive-loop-optimizations`** (GCC) — typically an out-of-bounds access the optimizer proved. Inspect the two `itkESMDemonsRegistrationFunction.hxx` / `itkWarpImageFilter.hxx` loops carefully; **this is the only cluster likely to hide a real bug**, not just noise.
- **`-Wallocator-wrappers`** — a single file, `itkImportImageContainer.hxx`; check the realloc path against the newer libc++ allocator API.
- **`-Wlifetime-safety-invalidation` / `-use-after-free`** — brand-new ClangMain diagnostics. Verify each is real before churning code; several may be trunk-Clang false positives. **Do not mass-edit widely-included headers such as `itkSimplexMesh.h` to silence an unstable diagnostic** — confirm upstream Clang considers them actionable first.
3. Prefer one PR per flag (or per module cluster) for clean review, following #6366's pattern.
4. Skip `Modules/Remote/Cuberille` — fix that upstream in the remote module.

Related

- #6364 — COMP: AppleClang CTAD test fix
- #6365 — COMP: float-space-precision Jacobian determinant test
- #6366 — STYLE: deprecated `GetIndex()` → `ComputeIndex()` (the previous large warning bucket)
- #4877 — Report all warnings in CI builds (about surfacing warnings, not clearing this backlog)

---

Contributor guide

Open the contributing guide

Research direction

Start by taking a fresh warning snapshot from the listed CDash dashboards, since the counts and file lists are unverified and drift nightly. Review the named files for one warning cluster at a time, beginning with -Wnrvo and treating aggressive-loop warnings as possible real bugs; skip Modules/Remote/Cuberille. Done means a focused PR per flag or module cluster with current triage and validated fixes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.