Author: Timm Baeder Date: 2026-08-16T11:02:59+02:00 New Revision: f63a0e943131e8d05f6a7f68595fa6227afce54b
URL: https://github.com/llvm/llvm-project/commit/f63a0e943131e8d05f6a7f68595fa6227afce54b DIFF: https://github.com/llvm/llvm-project/commit/f63a0e943131e8d05f6a7f68595fa6227afce54b.diff LOG: [clang][bytecode] Fix assertion failure in in valid continue stmt (#216547) We need to handle the missing TargetLabel here, similarly to what we do in break statements. Added: Modified: clang/lib/AST/ByteCode/Compiler.cpp clang/test/AST/ByteCode/cxx23.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index bfb5df69b0e3a..a8e2cb4a3c076 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -7023,7 +7023,9 @@ bool Compiler<Emitter>::visitContinueStmt(const ContinueStmt *S) { } } } - assert(TargetLabel); + + if (!TargetLabel) + return false; for (VariableScope<Emitter> *C = VarScope; C != ContinueScope; C = C->getParent()) { diff --git a/clang/test/AST/ByteCode/cxx23.cpp b/clang/test/AST/ByteCode/cxx23.cpp index 5607ec9b59cb5..17a4277205f86 100644 --- a/clang/test/AST/ByteCode/cxx23.cpp +++ b/clang/test/AST/ByteCode/cxx23.cpp @@ -650,6 +650,19 @@ namespace DynamicCast { } #if __cplusplus >= 202302L +namespace BrokenContinueLabel { + constexpr int test() { + bar: {} // all-note {{here}} + bar: // all-error {{redefinition of label 'bar'}} + for (;;) { + continue bar; // all-error {{only supported in C2y}} + } + return 0; + } + + static_assert(test(), ""); // all-error {{not an integral constant expression}} +} + namespace BrokenShuffleVector { typedef float __m128 __attribute__((__vector_size__(16))); _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
