diff mbox series

Fix maybe-uninitialized CodeView LF_INDEX warning

Message ID 20240812224514.29126-1-mark@harmstone.com
State New
Headers show
Series Fix maybe-uninitialized CodeView LF_INDEX warning | expand

Commit Message

Mark Harmstone Aug. 12, 2024, 10:45 p.m. UTC
Initialize last_type to 0 to silence two spurious maybe-uninitialized warnings.
We issue an LF_INDEX continuation subtype for any LF_FIELDLISTs that
overflow, so LF_INDEXes will always have a subtype preceding them (and
thus last_type will always be set).

gcc/
	* dwarf2codeview.cc (get_type_num_enumeration_type): Initialize last_type
	to 0.
	(get_type_num_struct): Likewise.
---
 gcc/dwarf2codeview.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jeff Law Aug. 14, 2024, 4:04 a.m. UTC | #1
On 8/12/24 4:45 PM, Mark Harmstone wrote:
> Initialize last_type to 0 to silence two spurious maybe-uninitialized warnings.
> We issue an LF_INDEX continuation subtype for any LF_FIELDLISTs that
> overflow, so LF_INDEXes will always have a subtype preceding them (and
> thus last_type will always be set).
> 
> gcc/
> 	* dwarf2codeview.cc (get_type_num_enumeration_type): Initialize last_type
> 	to 0.
> 	(get_type_num_struct): Likewise.
OK
jeff
diff mbox series

Patch

diff --git a/gcc/dwarf2codeview.cc b/gcc/dwarf2codeview.cc
index f7107021bc7..7e4faaa9388 100644
--- a/gcc/dwarf2codeview.cc
+++ b/gcc/dwarf2codeview.cc
@@ -2448,7 +2448,7 @@  get_type_num_enumeration_type (dw_die_ref type, bool in_struct)
   dw_die_ref first_child;
   codeview_custom_type *ct;
   uint16_t count = 0;
-  uint32_t last_type;
+  uint32_t last_type = 0;
 
   if (get_AT_flag (type, DW_AT_declaration))
     return add_enum_forward_def (type);
@@ -2726,7 +2726,7 @@  get_type_num_struct (dw_die_ref type, bool in_struct, bool *is_fwd_ref)
   dw_die_ref first_child;
   codeview_custom_type *ct;
   uint16_t num_members = 0;
-  uint32_t last_type;
+  uint32_t last_type = 0;
   const char *name;
 
   if ((in_struct && get_AT_string (type, DW_AT_name))