[clang] [Clang][AST] Fix extending an unsigned to signed in `ExprConstant.cpp` (PR #180563)
Thibault Monnier via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 14 04:09:10 PST 2026
https://github.com/Thibault-Monnier updated https://github.com/llvm/llvm-project/pull/180563
>From 2dc392f0259700bb0d030d1205a27b611c2133fb Mon Sep 17 00:00:00 2001
From: Thibault-Monnier <thibaultmonni at gmail.com>
Date: Mon, 9 Feb 2026 18:12:28 +0100
Subject: [PATCH 1/2] Fix
---
clang/lib/AST/ExprConstant.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index d4068368f5b9d..0326273cd629a 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -9633,7 +9633,7 @@ bool LValueExprEvaluator::VisitArraySubscriptExpr(const ArraySubscriptExpr *E) {
if (Success) {
Result.setFrom(Info.Ctx, Val);
HandleLValueVectorElement(Info, E, Result, VT->getElementType(),
- VT->getNumElements(), Index.getExtValue());
+ VT->getNumElements(), Index.getZExtValue());
}
return Success;
>From 936c47ec2314056f4c7161141440bbd556ea5524 Mon Sep 17 00:00:00 2001
From: Thibault-Monnier <thibaultmonni at gmail.com>
Date: Sat, 14 Feb 2026 13:08:00 +0100
Subject: [PATCH 2/2] Add test case and update ReleaseNotes
---
clang/docs/ReleaseNotes.rst | 1 +
clang/test/CodeGenCXX/vector.cpp | 6 ++++++
2 files changed, 7 insertions(+)
create mode 100644 clang/test/CodeGenCXX/vector.cpp
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 0dbea8efc2642..5f360523afe37 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -274,6 +274,7 @@ Miscellaneous Clang Crashes Fixed
- Fixed a crash when using loop hint with a value dependent argument inside a
generic lambda. (#GH172289)
- Fixed a crash in C++ overload resolution with ``_Atomic``-qualified argument types. (#GH170433)
+- Fixed a crash when subscripting a vector type with large unsigned integer values. (#GH180563)
OpenACC Specific Changes
------------------------
diff --git a/clang/test/CodeGenCXX/vector.cpp b/clang/test/CodeGenCXX/vector.cpp
new file mode 100644
index 0000000000000..2a583afa197d2
--- /dev/null
+++ b/clang/test/CodeGenCXX/vector.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 %s -triple x86_64-linux-gnu -emit-llvm -o - | FileCheck %s
+
+// CHECK: gh_180563
+int gh_180563(int __attribute__((vector_size(8))) v) {
+ return v[~0UL];
+}
More information about the cfe-commits
mailing list