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]

[PATCH]: bfd: Fix uninitialized data warnings on AIX


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: bfd-aix-warnings.txt
Description: Text document

>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


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