This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: uninitialized variables


On Sat, Sep 11, 2010 at 09:41:36PM -0300, Lucas Clemente Vella wrote:
> These uninitialized variables in bfd/elf32-arm.c caused the compilation
> to fail with -Werror (the default) and -O3 (my choice)
[snip patch]

Thanks for the report.  I have applied this patch instead.

	* elf32-arm.c (find_stub_size_and_template): Avoid uninitialized
	var warning at -O3.

Index: bfd/elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.245
diff -u -p -r1.245 elf32-arm.c
--- bfd/elf32-arm.c	11 Oct 2010 07:38:53 -0000	1.245
+++ bfd/elf32-arm.c	25 Oct 2010 06:28:27 -0000
@@ -3704,7 +3704,12 @@ find_stub_size_and_template (enum elf32_
   unsigned int size;
 
   template_sequence = stub_definitions[stub_type].template_sequence;
+  if (stub_template)
+    *stub_template = template_sequence;
+
   template_size = stub_definitions[stub_type].template_size;
+  if (stub_template_size)
+    *stub_template_size = template_size;
 
   size = 0;
   for (i = 0; i < template_size; i++)
@@ -3723,16 +3728,10 @@ find_stub_size_and_template (enum elf32_
 
 	default:
 	  BFD_FAIL ();
-	  return FALSE;
+	  return 0;
 	}
     }
 
-  if (stub_template)
-    *stub_template = template_sequence;
-
-  if (stub_template_size)
-    *stub_template_size = template_size;
-
   return size;
 }
 


-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]