This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Commit: Fix may be used uninitialised warnings
- From: Nick Clifton <nickc at redhat dot com>
- To: binutils at sourceware dot org
- Date: Wed, 06 Mar 2013 16:18:12 +0000
- Subject: Commit: Fix may be used uninitialised warnings
Hi Guys,
I am checking in the patch below to fix a couple of "<var> may be used
uninitialized in this function" warnings from a recent version of GCC.
Cheers
Nick
ld/ChangeLog
2013-03-06 Nick Clifton <nickc@redhat.com>
* ldfile.c (ldfile_open_command_file_1): Initialise sysrooted.
binutils/ChangeLog
2013-03-06 Nick Clifton <nickc@redhat.com>
* strings.c (get_char): Initialise buf array.
Index: ld/ldfile.c
===================================================================
RCS file: /cvs/src/src/ld/ldfile.c,v
retrieving revision 1.67
diff -u -3 -p -r1.67 ldfile.c
--- ld/ldfile.c 13 Jul 2012 13:20:26 -0000 1.67
+++ ld/ldfile.c 6 Mar 2013 16:19:16 -0000
@@ -594,7 +592,7 @@ static void
ldfile_open_command_file_1 (const char *name, bfd_boolean default_only)
{
FILE *ldlex_input_stack;
- bfd_boolean sysrooted;
+ bfd_boolean sysrooted = FALSE;
ldlex_input_stack = ldfile_find_command_file (name, default_only, &sysrooted);
Index: binutils/strings.c
===================================================================
RCS file: /cvs/src/src/binutils/strings.c,v
retrieving revision 1.49
diff -u -3 -p -r1.49 strings.c
--- binutils/strings.c 9 Feb 2012 04:51:44 -0000 1.49
+++ binutils/strings.c 6 Mar 2013 16:19:16 -0000
@@ -456,7 +454,7 @@ get_char (FILE *stream, file_ptr *addres
{
int c, i;
long r = EOF;
- unsigned char buf[4];
+ unsigned char buf[4] = { 0, 0, 0, 0 };
for (i = 0; i < encoding_bytes; i++)
{