* [PATCH]: bfd: Fix uninitialized data warnings on AIX
@ 2017-03-08 13:19 Sam Thursfield
2017-03-09 17:03 ` Nick Clifton
0 siblings, 1 reply; 2+ messages in thread
From: Sam Thursfield @ 2017-03-08 13:19 UTC (permalink / raw)
To: binutils
[-- Attachment #1: Type: text/plain, Size: 290 bytes --]
Hello
I hit a bunch of compile warnings compiling on powerpc-ibm-aix7.2.0.0
using GCC 6.3.0.
Attached is a patch which fixes them. I've also attached the compile
warnings that I see without the patch.
Thanks
Sam
--
Sam Thursfield, Codethink Ltd.
Office telephone: +44 161 236 5575
[-- Attachment #2: bfd-aix-warnings.txt --]
[-- Type: text/plain, Size: 5389 bytes --]
gmake[2]: Entering directory '/home/code/src/binutils-gdb/bfd'
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -DAIX_5_CORE -DAIX_CORE_DUMPX_CORE -DAIX_CORE -DAIX_WEAK_SUPPORT -I. -I. -I./../include -DHAVE_rs6000_xcoff_vec -DHAVE_rs6000_xcoff64_aix_vec -DHAVE_plugin_vec -I./../intl -DBINDIR='"/opt/binutils-git/bin"' -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -I./../zlib -g -O2 -MT rs6000-core.lo -MD -MP -MF .deps/rs6000-core.Tpo -c -o rs6000-core.lo rs6000-core.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -DAIX_5_CORE -DAIX_CORE_DUMPX_CORE -DAIX_CORE -DAIX_WEAK_SUPPORT -I. -I. -I./../include -DHAVE_rs6000_xcoff_vec -DHAVE_rs6000_xcoff64_aix_vec -DHAVE_plugin_vec -I./../intl -DBINDIR=\"/opt/binutils-git/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -I./../zlib -g -O2 -MT rs6000-core.lo -MD -MP -MF .deps/rs6000-core.Tpo -c rs6000-core.c -o rs6000-core.o
rs6000-core.c: In function 'rs6000coff_core_p':
rs6000-core.c:325:14: error: 'vminfo_addr' may be used uninitialized in this function [-Werror=maybe-uninitialized]
asect->vma = vma;
~~~~~~~~~~~^~~~~
rs6000-core.c:654:14: note: 'vminfo_addr' was declared here
bfd_vma vminfo_addr;
^~~~~~~~~~~
rs6000-core.c:326:18: error: 'vminfo_offset' may be used uninitialized in this function [-Werror=maybe-uninitialized]
asect->filepos = filepos;
~~~~~~~~~~~~~~~^~~~~~~~~
rs6000-core.c:653:15: note: 'vminfo_offset' was declared here
file_ptr vminfo_offset;
^~~~~~~~~~~~~
rs6000-core.c:324:15: error: 'vminfo_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]
asect->size = size;
~~~~~~~~~~~~^~~~~~
rs6000-core.c:652:20: note: 'vminfo_size' was declared here
bfd_size_type vminfo_size;
^~~~~~~~~~~
rs6000-core.c:646:6: error: 'c_vmm' may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (bfd_seek (abfd, c_vmm, SEEK_SET) != 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rs6000-core.c:326:18: error: 'c_data' may be used uninitialized in this function [-Werror=maybe-uninitialized]
asect->filepos = filepos;
~~~~~~~~~~~~~~~^~~~~~~~~
rs6000-core.c:564:14: note: 'c_data' was declared here
file_ptr c_data, c_vmm;
^~~~~~
rs6000-core.c:649:2: error: 'c_vmregions' may be used uninitialized in this function [-Werror=maybe-uninitialized]
for (i = 0; i < c_vmregions; i++)
^~~
rs6000-core.c:324:15: error: 'c_datasize' may be used uninitialized in this function [-Werror=maybe-uninitialized]
asect->size = size;
~~~~~~~~~~~~^~~~~~
rs6000-core.c:563:19: note: 'c_datasize' was declared here
bfd_size_type c_datasize, c_vmregions;
^~~~~~~~~~
rs6000-core.c:511:8: error: 'c_stackend' may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (!make_bfd_asection (abfd, ".stack",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c_size, c_stackend - c_size, c_stack))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rs6000-core.c:324:15: error: 'c_lsize' may be used uninitialized in this function [-Werror=maybe-uninitialized]
asect->size = size;
~~~~~~~~~~~~^~~~~~
rs6000-core.c:346:36: note: 'c_lsize' was declared here
bfd_size_type c_size, c_regsize, c_lsize;
^~~~~~~
rs6000-core.c:511:8: error: 'c_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (!make_bfd_asection (abfd, ".stack",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c_size, c_stackend - c_size, c_stack))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rs6000-core.c:463:4: error: 'c_loader' may be used uninitialized in this function [-Werror=maybe-uninitialized]
&& (
~
#ifndef BFD64
~~~~~~~~~~~~~
c_loader < (file_ptr) sizeof core.old
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#else
~~~~~
c_loader < (file_ptr) sizeof core.new_dump
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#endif
~~~~~~
|| c_loader >= statbuf.st_size
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|| c_loader >= c_stack))
^~~~~~~~~~~~~~~~~~~~~~~
rs6000-core.c:463:4: error: 'c_stack' may be used uninitialized in this function [-Werror=maybe-uninitialized]
rs6000-core.c:444:16: error: 'c_flag' may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (!(c_flag & (FULL_CORE | CORE_TRUNC)))
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
rs6000-core.c: In function 'rs6000coff_core_file_matches_executable_p':
rs6000-core.c:727:36: error: 'c_loader' may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (bfd_seek (core_bfd, c_loader + size, SEEK_SET) != 0)
~~~~~~~~~^~~~~~
cc1: all warnings being treated as errors
Makefile:1688: recipe for target 'rs6000-core.lo' failed
gmake[2]: *** [rs6000-core.lo] Error 1
gmake[2]: Leaving directory '/home/code/src/binutils-gdb/bfd'
Makefile:1731: recipe for target 'all-recursive' failed
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory '/home/code/src/binutils-gdb/bfd'
Makefile:1201: recipe for target 'all' failed
gmake: *** [all] Error 2
[-- Attachment #3: bfd-aix-warnings.patch --]
[-- Type: text/x-patch, Size: 1412 bytes --]
From 1368829232b829d23b1d3bfc006118b3330a0a6a Mon Sep 17 00:00:00 2001
From: Sam Thursfield <sam.thursfield@codethink.co.uk>
Date: Wed, 1 Mar 2017 11:51:05 -0600
Subject: [PATCH] bfd: Fix initialized data warnings for rs6000 on 64-bit AIX
>= 4.3
I got a load of compile warnings about initialized memory in
rs6000-core.c when compiling on an AIX 7.2 POWER machine.
The cause is the CORE_NEW macro. This macro should (according to
the comment) return 1 if a given CoreHdr structure contains data
in the new AIX 4.3+ format. On systems where AIX_CORE_DUMPX_CORE
and BFD64 are true the CoreHdr structure can only contain a new
style core dump so the macro always evaluates to 1. The compiler
doesn't know this and gives a warning. Still, since we know the
macro will always evaluate to 1 we can define it to 1 and fix the
warnings.
bfd/ChangeLog:
* rs6000-core.c: Simplify CORE_NEW macro when AIX_CORE_DUMPX_CORE
and BFD64 are true to avoid compile warning.
---
bfd/rs6000-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bfd/rs6000-core.c b/bfd/rs6000-core.c
index 0e66cc3..e4a8cd0 100644
--- a/bfd/rs6000-core.c
+++ b/bfd/rs6000-core.c
@@ -137,7 +137,7 @@ typedef union
# ifndef BFD64
# define CORE_NEW(c) (!(c).old.c_entries)
# else
-# define CORE_NEW(c) (!(c).new_dump.c_entries)
+# define CORE_NEW(c) 1
# endif
#else
# define CORE_NEW(c) 0
--
2.2.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH]: bfd: Fix uninitialized data warnings on AIX
2017-03-08 13:19 [PATCH]: bfd: Fix uninitialized data warnings on AIX Sam Thursfield
@ 2017-03-09 17:03 ` Nick Clifton
0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2017-03-09 17:03 UTC (permalink / raw)
To: Sam Thursfield, binutils
Hi Sam,
> Attached is a patch which fixes them.
Thanks! I have applied your patch. Please let me know if you continue to have problems like this.
Cheers
Nick
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-09 17:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-08 13:19 [PATCH]: bfd: Fix uninitialized data warnings on AIX Sam Thursfield
2017-03-09 17:03 ` 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).