https://github.com/nataliakokoromyti updated 
https://github.com/llvm/llvm-project/pull/175512

>From 99a8764678429036c989dd2ba2d4c0f112c627b9 Mon Sep 17 00:00:00 2001
From: Natalia Kokoromyti <[email protected]>
Date: Mon, 12 Jan 2026 02:02:56 -0800
Subject: [PATCH 1/5] [clang][bytecode] Fix assertion in
 Pointer::isInitialized() for GlobalInlineDescriptor

The existing check for BS.Base == sizeof(GlobalInlineDescriptor) required

both isRoot() and Offset == BS.Base to be true. The pointer can have BS.Base == 
sizeof(GlobalInlineDescriptor) without satisfying isRoot() (which checks if 
Base equals getMetadataSize() or 0). This caused getFieldDesc() to be called, 
which then calls getInlineDesc(), triggering the assertion 'BS.Base != 
sizeof(GlobalInlineDescriptor)'.

The fix removes the overly restrictive conditions and checks only for

BS.Base == sizeof(GlobalInlineDescriptor) to determine if we should go to

the GlobalInlineDescriptor's InitState.

Fixes #175432
---
 clang/lib/AST/ByteCode/Pointer.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Pointer.cpp 
b/clang/lib/AST/ByteCode/Pointer.cpp
index c5e0fd83021d7..53582bccba5b8 100644
--- a/clang/lib/AST/ByteCode/Pointer.cpp
+++ b/clang/lib/AST/ByteCode/Pointer.cpp
@@ -448,8 +448,7 @@ bool Pointer::isInitialized() const {
   if (!isBlockPointer())
     return true;
 
-  if (isRoot() && BS.Base == sizeof(GlobalInlineDescriptor) &&
-      Offset == BS.Base) {
+  if (BS.Base == sizeof(GlobalInlineDescriptor)) {
     const auto &GD = block()->getBlockDesc<GlobalInlineDescriptor>();
     return GD.InitState == GlobalInitState::Initialized;
   }

>From 02e6ceb4705970bb7c7aa81345363c4148e3f22a Mon Sep 17 00:00:00 2001
From: Natalia Kokoromyti <[email protected]>
Date: Mon, 12 Jan 2026 02:12:16 -0800
Subject: [PATCH 2/5] [clang][bytecode] Add test case for issue #175432

Add test case for assertion crash with GlobalInlineDescriptor
when checking initialization of constexpr pointer arrays.
---
 clang/test/AST/ByteCode/arrays.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/clang/test/AST/ByteCode/arrays.cpp 
b/clang/test/AST/ByteCode/arrays.cpp
index d83ae97fc8213..f9b4f7b55332a 100644
--- a/clang/test/AST/ByteCode/arrays.cpp
+++ b/clang/test/AST/ByteCode/arrays.cpp
@@ -835,3 +835,12 @@ namespace MultiDimConstructExpr {
   constexpr b d;
   static_assert(d.m[2][1].p == &d.m[2][1]);
 }
+
+// Test for issue #175432 - assertion crash with GlobalInlineDescriptor
+// Previously crashed with: Assertion `BS.Base != 
sizeof(GlobalInlineDescriptor)` failed
+namespace gh175432 {
+  constexpr const int *arr[][2] = {{nullptr, nullptr}};
+  static_assert(arr[0][0] == nullptr, "");
+  static_assert(arr[0][1] == nullptr, "");
+}
+

>From d6b4680612cb5e79692309201681a82694c3d698 Mon Sep 17 00:00:00 2001
From: Natalia Kokoromyti <[email protected]>
Date: Mon, 12 Jan 2026 02:24:44 -0800
Subject: [PATCH 3/5] [clang] Add release note for #175432 fix

---
 clang/docs/ReleaseNotes.rst | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index f62298938af93..45f0bbcec748b 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -663,6 +663,8 @@ Bug Fixes to AST Handling
 - Fix comment lexing of special command names (#GH152943)
 - Use `extern` as a hint to continue parsing when recovering from a malformed 
declaration.
 
+- Fixed assertion crash in bytecode interpreter when checking initialization of
+  constexpr pointer arrays with GlobalInlineDescriptor. (#GH175432)
 Miscellaneous Bug Fixes
 ^^^^^^^^^^^^^^^^^^^^^^^
 - Fixed missing diagnostics of ``diagnose_if`` on templates involved in 
initialization. (#GH160776)

>From e292919202dc47139c73dff0918e386f4aaabfbf Mon Sep 17 00:00:00 2001
From: nataliakokoromyti <[email protected]>
Date: Mon, 12 Jan 2026 02:26:47 -0800
Subject: [PATCH 4/5] Update ReleaseNotes.rst

---
 clang/docs/ReleaseNotes.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 45f0bbcec748b..b9763cc7460cd 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -662,9 +662,9 @@ Bug Fixes to AST Handling
 - Fix unrecognized html tag causing undesirable comment lexing (#GH152944)
 - Fix comment lexing of special command names (#GH152943)
 - Use `extern` as a hint to continue parsing when recovering from a malformed 
declaration.
-
 - Fixed assertion crash in bytecode interpreter when checking initialization of
   constexpr pointer arrays with GlobalInlineDescriptor. (#GH175432)
+
 Miscellaneous Bug Fixes
 ^^^^^^^^^^^^^^^^^^^^^^^
 - Fixed missing diagnostics of ``diagnose_if`` on templates involved in 
initialization. (#GH160776)

>From c13208ce1984982a9a2ba88b977e27503b2c2577 Mon Sep 17 00:00:00 2001
From: nataliakokoromyti <[email protected]>
Date: Mon, 12 Jan 2026 02:27:41 -0800
Subject: [PATCH 5/5] Update ReleaseNotes.rst

---
 clang/docs/ReleaseNotes.rst | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index b9763cc7460cd..e53220e203ce7 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -662,8 +662,7 @@ Bug Fixes to AST Handling
 - Fix unrecognized html tag causing undesirable comment lexing (#GH152944)
 - Fix comment lexing of special command names (#GH152943)
 - Use `extern` as a hint to continue parsing when recovering from a malformed 
declaration.
-- Fixed assertion crash in bytecode interpreter when checking initialization of
-  constexpr pointer arrays with GlobalInlineDescriptor. (#GH175432)
+- Fixed assertion crash in bytecode interpreter when checking initialization 
of constexpr pointer arrays with GlobalInlineDescriptor. (#GH175432)
 
 Miscellaneous Bug Fixes
 ^^^^^^^^^^^^^^^^^^^^^^^

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to