Skip to content

NanoVDB HDDA.h triggers -Wmaybe-uninitialized with GCC 14.2.1 #2177

@harrism

Description

@harrism

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:

  1. Explicitly initializing mDelta in the HDDA constructor/init() to silence the warning
  2. Adding a targeted #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" around the affected code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions