From 3fa779425cc550afb6e18671c45dba0e21d1d273 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Mon, 2 Dec 2024 17:38:55 +0000 Subject: 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(-) (limited to 'gcc') diff --git a/gcc/rust/hir/rust-hir-dump.cc b/gcc/rust/hir/rust-hir-dump.cc index be785b9..2590eed 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"); } -- cgit v1.1