[clang] [clang][bytecode] Reject more constexpr-unknown pointers in CheckStore (PR #194529)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 27 21:03:42 PDT 2026
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/194529
Even in constant contexts.
>From 0ec8b8a92978661bb8e571bc5c5d9b44cc27571b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Tue, 28 Apr 2026 06:02:33 +0200
Subject: [PATCH] [clang][bytecode] Reject more constexpr-unknown pointers in
CheckStore
Even in constant contexts.
---
clang/lib/AST/ByteCode/Interp.cpp | 2 +-
clang/test/AST/ByteCode/openmp.cpp | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index 21a75b8fb4d45..61b473942f9f7 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -894,7 +894,7 @@ bool CheckStore(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
return false;
if (!CheckVolatile(S, OpPC, Ptr, AK_Assign))
return false;
- if (!S.inConstantContext() && isConstexprUnknown(Ptr))
+ if (isConstexprUnknown(Ptr))
return false;
return true;
}
diff --git a/clang/test/AST/ByteCode/openmp.cpp b/clang/test/AST/ByteCode/openmp.cpp
index c7cccfdd1de9a..79223b2e57e7d 100644
--- a/clang/test/AST/ByteCode/openmp.cpp
+++ b/clang/test/AST/ByteCode/openmp.cpp
@@ -26,4 +26,11 @@ int test2() {
}
}
-
+void test3() {
+ char i = 0;
+ char &c = i;
+#pragma omp for collapse(2)
+ for (c = 0; c < 2; c++)
+ for (int j = 0; j < 4 + c; j++)
+ ;
+}
More information about the cfe-commits
mailing list