This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Fix uninitialized warning in bfd
- From: Cary Coutant <ccoutant at google dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Wed, 15 May 2013 15:57:20 -0700
- Subject: Fix uninitialized warning in bfd
When I build binutils with -Werror and GCC 4.7, I get one
uninitialized warning in ecoff.c. This is a case where the compiler is
wrong, but the predicate-aware uninit analysis isn't quite up to the
task, so I've added an explicit initializer. (Oddly enough, the
compiler is able to analyze the control flow for esize, even though
the two situations look very much alike.) With this patch, I can now
build binutils with --enable-targets=all and -Werror.
OK for trunk?
-cary
2013-05-15 Cary Coutant <ccoutant@google.com>
* ecoff.c (ecoff_link_check_archive_element): Add initializer for
external_ext_size.
Index: ecoff.c
===================================================================
RCS file: /cvs/src/src/bfd/ecoff.c,v
retrieving revision 1.78
diff -u -p -r1.78 ecoff.c
--- ecoff.c 24 Apr 2013 13:19:27 -0000 1.78
+++ ecoff.c 15 May 2013 22:52:54 -0000
@@ -3561,7 +3561,7 @@ ecoff_link_check_archive_element (bfd *a
void (* const swap_ext_in) (bfd *, void *, EXTR *)
= backend->debug_swap.swap_ext_in;
HDRR *symhdr;
- bfd_size_type external_ext_size;
+ bfd_size_type external_ext_size = 0;
void * external_ext = NULL;
bfd_size_type esize;
char *ssext = NULL;