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

via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 2 01:05:03 PDT 2026


Author: Timm Baeder
Date: 2026-06-02T10:04:58+02:00
New Revision: e174a520b21103890ebc7367952202914b2baf88

URL: https://github.com/llvm/llvm-project/commit/e174a520b21103890ebc7367952202914b2baf88
DIFF: https://github.com/llvm/llvm-project/commit/e174a520b21103890ebc7367952202914b2baf88.diff

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

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/Compiler.cpp
    clang/test/AST/ByteCode/cxx20.cpp

Removed: 
    


################################################################################
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