[PATCH] ARM/gas: Fix a build failure with GCC 4.3.3

Maciej W. Rozycki macro@codesourcery.com
Wed Aug 20 23:56:00 GMT 2014


Hi,

 The change below fixes a GAS build failure with GCC 4.3.3 for ARM 
targets:

cc1: warnings being treated as errors
.../gas/config/tc-arm.c: In function 'add_to_lit_pool':
.../gas/config/tc-arm.c:3193: error: 'imm1' may be used uninitialized in this function

The variable is only initialised in a conditional block and while some 
versions of GCC may be smart enough to see that the variable is only later 
read under the same conditions other versions may not be as smart.

 Verified to remove the problem with arm-aout, arm-coff, arm-epoc-pe, 
arm-linuxeabi, arm-netbsdelf, arm-nto, arm-pe, arm-symbianelf, arm-vxworks 
and arm-wince-pe.  OK to apply?

2014-08-20  Maciej W. Rozycki  <macro@codesourcery.com>

	gas/
	* config/tc-arm.c (add_to_lit_pool): Preinitialize `imm1'.

  Maciej

binutils-gas-arm-add-to-lit-pool-fix.diff
Index: binutils-fsf-trunk-quilt/gas/config/tc-arm.c
===================================================================
--- binutils-fsf-trunk-quilt.orig/gas/config/tc-arm.c	2014-07-31 02:40:59.000000000 +0100
+++ binutils-fsf-trunk-quilt/gas/config/tc-arm.c	2014-08-20 21:40:04.137795341 +0100
@@ -3190,7 +3190,7 @@ add_to_lit_pool (unsigned int nbytes)
   literal_pool * pool;
   unsigned int entry, pool_size = 0;
   bfd_boolean padding_slot_p = FALSE;
-  unsigned imm1;
+  unsigned imm1 = 0;
   unsigned imm2 = 0;
 
   if (nbytes == 8)



More information about the Binutils mailing list