From cf123e5bed902a51223bbd0fd8baefa50a5993b0 Mon Sep 17 00:00:00 2001 From: Josh Ferrell Date: Mon, 18 Nov 2024 15:50:02 -0500 Subject: Fix crash when using DWARF export with array of 0-sized types --- rust/examples/dwarf/dwarf_export/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rust/examples') diff --git a/rust/examples/dwarf/dwarf_export/src/lib.rs b/rust/examples/dwarf/dwarf_export/src/lib.rs index 18cc1e21..9ebf3bc7 100644 --- a/rust/examples/dwarf/dwarf_export/src/lib.rs +++ b/rust/examples/dwarf/dwarf_export/src/lib.rs @@ -287,7 +287,7 @@ fn export_type( dwarf.unit.get_mut(array_dimension_die_uid).set( gimli::DW_AT_upper_bound, - AttributeValue::Data8((current_t.width() / element_type.width()) - 1), + AttributeValue::Data8(current_t.count() - 1), ); if element_type.type_class() != TypeClass::ArrayTypeClass { -- cgit v1.3.1