[clang] [clang][bytecode] Reject invalid UETT_OpenMPRequiredSimdAlign nodes (PR #200997)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 1 20:51:20 PDT 2026
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/200997
None
>From 5d3f6604ada15d5f50d1a90816b1ce83bd9c346a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Tue, 2 Jun 2026 05:48:54 +0200
Subject: [PATCH] [clang][bytecode] Reject invalid UETT_OpenMPRequiredSimdAlign
nodes
---
clang/lib/AST/ByteCode/Compiler.cpp | 2 ++
clang/test/AST/ByteCode/cxx20.cpp | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 732a9e227430c..989a28dc2be14 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -2649,6 +2649,8 @@ bool Compiler<Emitter>::VisitUnaryExprOrTypeTraitExpr(
}
if (Kind == UETT_OpenMPRequiredSimdAlign) {
+ if (E->containsErrors())
+ return false;
assert(E->isArgumentType());
unsigned Bits = ASTCtx.getOpenMPDefaultSimdAlign(E->getArgumentType());
diff --git a/clang/test/AST/ByteCode/cxx20.cpp b/clang/test/AST/ByteCode/cxx20.cpp
index d3e6265a9cbe7..90e8fa4657786 100644
--- a/clang/test/AST/ByteCode/cxx20.cpp
+++ b/clang/test/AST/ByteCode/cxx20.cpp
@@ -1367,3 +1367,8 @@ namespace IndirectFieldInitializer {
static_assert(A().x == 3, "");
}
+
+namespace InvalidOMPRequiredSimdAlign {
+ typedef decltype(sizeof(int)) T;
+ constexpr T foo(T x) { return __builtin_omp_required_simd_align * 42; } // both-error {{indirection requires pointer operand}}
+}
More information about the cfe-commits
mailing list