AcademySoftwareFoundation / AcademySoftwareFoundation/openvdb
NanoVDB HDDA.h triggers -Wmaybe-uninitialized with GCC 14.2.1
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.4k
- Forks
- 777
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 34
Description
Summary
Building with GCC 14.2.1 (Red Hat gcc-toolset-14 on Rocky Linux 8) and -Werror produces a -Wmaybe-uninitialized warning in nanovdb/math/HDDA.h at line 171.
Error
nanovdb/nanovdb/math/HDDA.h:171:28: error: '*(nanovdb::math::Vec3<float>*)((char*)&it + offsetof(fvdb::HDDASegmentIterator<nanovdb::ReadAccessor<nanovdb::ValueOnIndex, 0, 1, 2>, float>,fvdb::HDDASegmentIterator<nanovdb::ReadAccessor<nanovdb::ValueOnIndex, 0, 1, 2>, float>::mHdda.nanovdb::math::HDDA<nanovdb::math::Ray<float>, nanovdb::math::Coord>::mDelta)).nanovdb::math::Vec3<float>::mVec[0]' may be used uninitialized [-Werror=maybe-uninitialized]
171 | mNext[ axis] += mDim * mDelta[axis];
The mDelta member of HDDA is flagged as potentially uninitialized when used in this expression.
Environment
- Compiler: GCC 14.2.1 (gcc-toolset-14 on Rocky Linux 8)
- NanoVDB version: v32.9.1 (commit 0c4c067bd5f23f0c1b05ab224faa0ad89f73a4b9 via CPM)
- Build type: Release (with
-Wall -Werror) - CUDA: NVIDIA nvcc 13.0.88 with GCC 14.2.1 as host compiler (via
-Xcompiler=-Wall,-Werror)
Notes
We have confirmed that conda-forge's GCC 14.2.0 does not trigger this warning on the same code, so it appears specific to the 14.2.1 patch level. -Wmaybe-uninitialized false positives are a known class of GCC issue.
Workaround
We are suppressing with -Wno-maybe-uninitialized in our downstream build system.
Suggested Fix
Consider either:
- Explicitly initializing
mDeltain theHDDAconstructor/init()to silence the warning - Adding a targeted
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"around the affected code
Contributor 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.
Research direction
Start with nanovdb/math/HDDA.h around line 171 and inspect how mDelta is initialized in the HDDA constructor or init(). Reproduce the warning with GCC 14.2.1, Release, and -Wall -Werror, including the CUDA host-compiler setup if relevant. Done means the affected build no longer emits -Wmaybe-uninitialized without relying on the downstream suppression.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100