From 754d2b1e21775f54287391eae871ccd4344a0352 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Mon, 2 Dec 2024 17:38:55 +0000 Subject: [PATCH] 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 --- gcc/rust/hir/rust-hir-dump.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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"); }