diff options
author | Philip Herron <herron.philip@googlemail.com> | 2025-04-16 17:00:28 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-04-28 16:18:53 +0200 |
commit | 75a57211f698242d247f5c4230b8348b236f9ded (patch) | |
tree | bb6bc0acdedfe35d671c4b687f889755e97704c6 /gcc | |
parent | afdb4a46262ba527823ea9bbe10ffb5859a31ebd (diff) | |
download | gcc-75a57211f698242d247f5c4230b8348b236f9ded.zip gcc-75a57211f698242d247f5c4230b8348b236f9ded.tar.gz gcc-75a57211f698242d247f5c4230b8348b236f9ded.tar.bz2 |
gccrs: Fix crash in hir dump as labels are optional
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::visit): add guard for optional label
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/hir/rust-hir-dump.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/rust/hir/rust-hir-dump.cc b/gcc/rust/hir/rust-hir-dump.cc index dafa823..16fce6b 100644 --- a/gcc/rust/hir/rust-hir-dump.cc +++ b/gcc/rust/hir/rust-hir-dump.cc @@ -1284,7 +1284,9 @@ Dump::visit (BlockExpr &e) do_expr (e); do_inner_attrs (e); put_field ("tail_reachable", std::to_string (e.is_tail_reachable ())); - put_field ("label", e.get_label ().as_string ()); + + if (e.has_label ()) + put_field ("label", e.get_label ().as_string ()); visit_collection ("statements", e.get_statements ()); |