public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [buildrobot] readelf.c (decode_arm_unwind): Initialise addr structure
@ 2013-10-14 11:19 Jan-Benedict Glaw
  2013-10-14 11:30 ` nick clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Jan-Benedict Glaw @ 2013-10-14 11:19 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Binutils

[-- Attachment #1: Type: text/plain, Size: 2832 bytes --]

Hi Nick!

Buildrobot found this:

libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -o addr2line addr2line.o bucomm.o version.o filemode.o  ../bfd/.libs/libbfd.a ../libiberty/libiberty.a -lz
gcc -DHAVE_CONFIG_H -I. -I/home/jbglaw/repos/binutils/binutils  -I. -I/home/jbglaw/repos/binutils/binutils -I../bfd -I/home/jbglaw/repos/binutils/binutils/../bfd -I/home/jbglaw/repos/binutils/binutils/../include -DLOCALEDIR="\"/home/jbglaw/build/mipsel-linux/_install_/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT readelf.o -MD -MP -MF .deps/readelf.Tpo -c -o readelf.o /home/jbglaw/repos/binutils/binutils/readelf.c
cc1: warnings being treated as errors
/home/jbglaw/repos/binutils/binutils/readelf.c: In function ‘decode_arm_unwind’:
/home/jbglaw/repos/binutils/binutils/readelf.c:7173: error: missing initializer
/home/jbglaw/repos/binutils/binutils/readelf.c:7173: error: (near initialization for ‘addr.offset’)
make[3]: *** [readelf.o] Error 1


 5803 struct absaddr
 5804   {
 5805     unsigned short section;
 5806     bfd_vma offset;
 5807   };
[...]
 7173   struct absaddr addr = { 0 };

I don't really see why GCC complains about it (and not init's `offset' with 0,
although you probably wanted to init offset instead of section.) And
it's only GCCs on some of the builders, not on all. See
http://toolchain.lug-owl.de/buildbot/timeline.php :

gcc110:  no complains:gcc (GCC) 4.7.2 20121109 (Red Hat 4.7.2-8)
pluto:   no complains:gcc (Debian 4.8.1-7) 4.8.1
gccbuild:no complains:gcc (Debian 4.8.1-7) 4.8.1
darkeye: no complains:gcc (Debian 4.8.1-7) 4.8.1

gcc15:   complains:   gcc (Debian 4.4.5-8) 4.4.5
gcc76:   complains:   gcc (Debian 4.4.5-8) 4.4.5

Looks like a compiler bug to me, uncovered by the recent partial
initialization of `addr'. Is it actually needed? `addr' is fully
initialized in get_unwind_section_word(). So I guess removing the
(incomplete) initializer isn't wrong and would remove the build
failure?


Untested:

2013-10-14  Jan-Benedict Glaw  <jbglaw@lug-owl.de>

binutils/
	* readelf.c (decode_arm_unwind): Don't initialize `addr'.


diff --git a/binutils/readelf.c b/binutils/readelf.c
index 32e0cf0..2156b78 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -7170,7 +7170,7 @@ decode_arm_unwind (struct arm_unw_aux_info *  aux,
 {
   int per_index;
   unsigned int more_words = 0;
-  struct absaddr addr = { 0 };
+  struct absaddr addr;
   bfd_vma sym_name = (bfd_vma) -1;
 
   if (remaining == 0)

MfG, JBG

-- 
      Jan-Benedict Glaw      jbglaw@lug-owl.de              +49-172-7608481
Signature of:                 Friends are relatives you make for yourself.
the second  :

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [buildrobot] readelf.c (decode_arm_unwind): Initialise addr structure
  2013-10-14 11:19 [buildrobot] readelf.c (decode_arm_unwind): Initialise addr structure Jan-Benedict Glaw
@ 2013-10-14 11:30 ` nick clifton
  0 siblings, 0 replies; 2+ messages in thread
From: nick clifton @ 2013-10-14 11:30 UTC (permalink / raw)
  To: Jan-Benedict Glaw; +Cc: Binutils

Hi Jan-Benedict,
>   7173   struct absaddr addr = { 0 };

*sigh*

   Is it actually needed?

No - this was to silence a false positive produced by the cppcheck tool.


> 2013-10-14  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
>
> binutils/
> 	* readelf.c (decode_arm_unwind): Don't initialize `addr'.

Approved - please apply.

Cheers
   Nick


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-14 11:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-14 11:19 [buildrobot] readelf.c (decode_arm_unwind): Initialise addr structure Jan-Benedict Glaw
2013-10-14 11:30 ` nick clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).