[all-commits] [llvm/llvm-project] a9804a: [clang] Fix crash on subobject access through _Ato...

arhwx via All-commits all-commits at lists.llvm.org
Mon Jul 13 12:27:29 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a9804ae41bceff2f169affa5b35506606a965880
      https://github.com/llvm/llvm-project/commit/a9804ae41bceff2f169affa5b35506606a965880
  Author: arhwx <arahwrm at gmail.com>
  Date:   2026-07-13 (Mon, 13 Jul 2026)

  Changed paths:
    M clang/docs/ReleaseNotes.md
    M clang/lib/AST/ExprConstant.cpp
    A clang/test/SemaCXX/atomic-constexpr.cpp

  Log Message:
  -----------
  [clang] Fix crash on subobject access through _Atomic in constant evaluation (#208923)

`findSubobject()` didn't look through `AtomicType` while walking a
designator, so reaching a subobject of an object wrapped in `_Atomic`
crashed: a null `CXXRecordDecl` deref for base classes (the segfault in
the issue) and a `cast<RecordType>` assertion for fields. The value of
an atomic object is already represented like a value of the underlying
type, so it's enough to look through the wrapper before dispatching on
the subobject kind.

The crash goes back to clang 9, and the new bytecode interpreter already
handles this correctly, but the test covers both evaluators anyway, at
C++14 (the earliest standard that can hit the crash) and at C++20 (so
`constinit` can verify the initializers are indeed constant).

Fixes #203328



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list