[PATCH] Fixes for a small number of compiler warnings

H.J. Lu hjl.tools@gmail.com
Wed Apr 1 03:32:00 GMT 2015


On Tue, Mar 31, 2015 at 8:27 PM, Alan Modra <amodra@gmail.com> wrote:
> On Tue, Mar 31, 2015 at 07:53:36PM -0700, H.J. Lu wrote:
>> This becomes a regression with the older GCC.
>
> Yes.  I'd rather cause that than have warnings with more recent gcc
> versions..  I also agree that we shouldn't worry too much about
> compilers other than gcc, and I know that self-assignment is something
> that C++ programmers need to worry about which is no doubt why the
> warning is on for Clang.
>
> I did consider just reverting the previous patch, but fixing a warning
> with a self-assignment just looks horrible to me, particularly when
> the warning is about an uninitialized variable.  I mean, it looks to
> me that a self-assignment actually creates an uninitialized variable
> access at the abstract level, when there wasn't one there before!

For this particular case, self-assignment causes no harm since
the variable will be initialized.

Will

struct bfd_link_hash_entry ehdr_start_save = { 0 };

for all compilers?

-- 
H.J.



More information about the Binutils mailing list