From: Pierre-Emmanuel Patry Date: Tue, 1 Apr 2025 14:10:38 +0000 (+0200) Subject: Update ast visitor with proper check for looplabel X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8a65b913d4c4f00c2b8aa6827c733786e4a0266e;p=thirdparty%2Fgcc.git Update ast visitor with proper check for looplabel The visitor was visiting loop label even when they did not exist. gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Add check for loop label before visiting it. Signed-off-by: Pierre-Emmanuel Patry --- diff --git a/gcc/rust/ast/rust-ast-visitor.cc b/gcc/rust/ast/rust-ast-visitor.cc index 7791489a166..3a06d2ddc4b 100644 --- a/gcc/rust/ast/rust-ast-visitor.cc +++ b/gcc/rust/ast/rust-ast-visitor.cc @@ -559,7 +559,8 @@ void DefaultASTVisitor::visit (AST::LoopExpr &expr) { visit_outer_attrs (expr); - visit (expr.get_loop_label ()); + if (expr.has_loop_label ()) + visit (expr.get_loop_label ()); visit (expr.get_loop_block ()); }