[PATCH] bfd: Fix -Wmaybe-uninitialized in elf-eh-frame.c
Aaron Merey
amerey@redhat.com
Fri Mar 15 15:57:08 GMT 2024
Fix the following build error:
elf-eh-frame.c: In function ‘skip_cfa_op’:
elf-eh-frame.c:354:33: error: ‘op’ may be used uninitialized [-Werror=maybe-uninitialized]
354 | switch (op & 0xc0 ? op & 0xc0 : op)
| ~~~~~~~~~~~~~~~~~~~~~~^~~~
elf-eh-frame.c:348:12: note: ‘op’ was declared here
348 | bfd_byte op;
| ^~
Build error seen with GCC 13.2.1 20231011 (Red Hat 13.2.1-4)
* elf-eh-frame.c (skip_cfa_op): Define variable op with value 0.
---
bfd/elf-eh-frame.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index 9a504234163..b52b97f783b 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -345,7 +345,7 @@ next_cie_fde_offset (const struct eh_cie_fde *ent,
static bool
skip_cfa_op (bfd_byte **iter, bfd_byte *end, unsigned int encoded_ptr_width)
{
- bfd_byte op;
+ bfd_byte op = 0;
bfd_vma length;
if (!read_byte (iter, end, &op))
--
2.43.0
More information about the Binutils
mailing list