[clang] [clang][bytecode] Reject invalid UETT_OpenMPRequiredSimdAlign nodes (PR #200997)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 1 20:51:58 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/200997.diff


2 Files Affected:

- (modified) clang/lib/AST/ByteCode/Compiler.cpp (+2) 
- (modified) clang/test/AST/ByteCode/cxx20.cpp (+5) 


``````````diff
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}}
+}

``````````

</details>


https://github.com/llvm/llvm-project/pull/200997


More information about the cfe-commits mailing list