From: Philip Herron Date: Mon, 2 Dec 2024 17:38:55 +0000 (+0000) Subject: gccrs: fix crash in hir dump X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9e07940629545e8c1997e7d24f9f431f3a88cb70;p=thirdparty%2Fgcc.git gccrs: fix crash in hir dump gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::visit): add missing check for no return value Signed-off-by: Philip Herron --- diff --git a/gcc/rust/hir/rust-hir-dump.cc b/gcc/rust/hir/rust-hir-dump.cc index 03c09021e457..a6a880121a1d 100644 --- a/gcc/rust/hir/rust-hir-dump.cc +++ b/gcc/rust/hir/rust-hir-dump.cc @@ -1365,7 +1365,8 @@ Dump::visit (ReturnExpr &e) begin ("ReturnExpr"); do_mappings (e.get_mappings ()); - visit_field ("return_expr", e.get_expr ()); + if (e.has_return_expr ()) + visit_field ("return_expr", e.get_expr ()); end ("ReturnExpr"); }