]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: fix crash in hir dump
authorPhilip Herron <herron.philip@googlemail.com>
Mon, 2 Dec 2024 17:38:55 +0000 (17:38 +0000)
committerArthur Cohen <arthur.cohen@embecosm.com>
Fri, 21 Mar 2025 11:33:09 +0000 (12:33 +0100)
gcc/rust/ChangeLog:

* hir/rust-hir-dump.cc (Dump::visit): add missing check for no return value

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/hir/rust-hir-dump.cc

index be785b9ebec20364307eadf0fc7c8b2d7a3fe44c..2590eed19ae8ae8e5450b612ed9a070d67ecf39c 100644 (file)
@@ -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");
 }