Skip to content

Upgrade clang-tools to 21 to fix clangd SIGSEGV on CUDA files#491

Open
fwilliams wants to merge 1 commit intoopenvdb:mainfrom
fwilliams:fw/fix-clangd-crash
Open

Upgrade clang-tools to 21 to fix clangd SIGSEGV on CUDA files#491
fwilliams wants to merge 1 commit intoopenvdb:mainfrom
fwilliams:fw/fix-clangd-crash

Conversation

@fwilliams
Copy link
Collaborator

@fwilliams fwilliams commented Mar 3, 2026

Summary

  • Upgrades clang-tools from 18 to 21 in the dev conda environment to fix a clangd crash (SIGSEGV) that occurs when building ASTs for .cuh files.
  • The crash is a known clang 18 bug in CUDA host/device operator delete resolution, triggered by delete this; in GCC 13.4.0's locale_classes.h (std::locale::facet::_M_remove_reference). It is fixed in clang 21.
  • Switches clang-format and clang specs to versioned package names (clang-format-18, clang-18) so they coexist with the clang-tools=21 dependency on clang-format=21. The clang-format-18 binary remains available as required by CI.

Motivation

clangd (shipped via clang-tools) crashes with a segmentation fault every time it tries to parse CUDA files that transitively include GCC's <locale> header (e.g. via PyTorch or standard library headers). This makes C++/CUDA language intelligence completely non-functional for affected files like GaussianCameras.cuh.

The crash stack trace:

Signalled during AST worker action: Build AST
Signal: SIGSEGV
clang::Sema::ActOnCXXDelete(...)
clang::Sema::MarkFunctionReferenced(...)

Upgrading to clang-tools 21 (which bundles clangd 21) resolves the crash since the underlying CUDA operator delete resolution bug was fixed upstream.

Test plan

  • Verified clangd --check=src/fvdb/detail/ops/gsplat/GaussianCameras.cuh completes without crash on clangd 21
  • Verified clang-format-18 --version still reports 18.1.8 after the environment rebuild
  • Rebuild the conda environment from env/dev_environment.yml and confirm clangd no longer crashes on CUDA files
  • Confirm CI passes (codestyle checks still use clang-format 18)

Made with Cursor

clangd 18 crashes (SIGSEGV) when building ASTs for .cuh files compiled
in CUDA mode. The crash occurs in Sema::MarkFunctionReferenced via
Sema::ActOnCXXDelete when parsing `delete this;` in GCC 13.4.0's
locale_classes.h (std::locale::facet::_M_remove_reference). This is a
known clang 18 bug in CUDA host/device operator-delete resolution that
is fixed in later versions.

Bump clang-tools from 18 to 21 so the fvdb conda environment ships a
working clangd. Because clang-tools=21 depends on clang-format=21,
switch the clang-format and clang specs to the versioned package names
(clang-format-18, clang-18) which coexist alongside the new
metapackages and keep the clang-format-18 binary available as required
by CI.

Signed-off-by: Francis Williams <francis@fwilliams.info>
Made-with: Cursor
@fwilliams fwilliams requested a review from a team as a code owner March 3, 2026 23:08
@harrism
Copy link
Contributor

harrism commented Mar 3, 2026

Why not use clang-tools 21 in CI as well?

@harrism harrism requested a review from swahtz March 3, 2026 23:48
@harrism harrism added this to fVDB Mar 4, 2026
@harrism harrism added the CI Issues related to the Github actions CI/CD. For build issues use CMake/Build label Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Issues related to the Github actions CI/CD. For build issues use CMake/Build

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants