build failure in aarch64-opc.c on macOS

Tamar Christina Tamar.Christina@arm.com
Mon Oct 8 09:48:00 GMT 2018


Forwarding to list as well.

> > -----Original Message-----
> > From: Szabolcs Nagy
> > Sent: Monday, October 8, 2018 10:43
> > To: Tom Tromey <tom@tromey.com>; Andrew Pinski <pinskia@gmail.com>
> > Cc: Tamar Christina <Tamar.Christina@arm.com>; binutils
> > <binutils@sourceware.org>
> > Subject: Re: build failure in aarch64-opc.c on macOS
> >
> > On 05/10/18 20:20, Tom Tromey wrote:
> > >>>>>> "Andrew" == Andrew Pinski <pinskia@gmail.com> writes:
> > >
> > > Andrew> On Fri, Oct 5, 2018 at 7:31 AM Tom Tromey <tom@tromey.com>
> > wrote:
> > >>>
> > >>> Hi.  A recent patch caused opcodes to fail to build on macOS (High
> > >>> Sierra) using the version of clang I have installed (Apple's clang-902).
> > >
> > > Andrew> This looks like a clang bug ...  {0} should have silienced
> > > Andrew> the -Wmissing-field-initializers warning.  {0} has always
> > > Andrew> been a way to "0" out a structure without warning.
> > >
> > > Either way, the build used to work, and now does not.
> > >
> >
> > please report the bug against the compiler (gcc had a similar issue
> > long time
> > ago) this really should be fixed, otherwise users will turn idiomatic
> > c code into awkward workarounds.
> >
> > (this is a core part of the c99 initializer design to allow {0} as a
> > universal initializer for any object type, using memset is not
> > guaranteed to be the same, and trying to guess the number of fields is
> > wrong for opaque types.)
> >
> 

They have a bug [1] and has been open for years. They however refuse to fix
it claiming that it'll make -Wmissing-field-initializers less useful. It seems
looking at the rest of the code that binutils uses memset here, which at least
gcc will inline and produce the same code at -O2.
 
So I'll change it to that.

[1] https://bugs.llvm.org/show_bug.cgi?id=21689
 
> > ideally binutils should be fixed too to detect broken compilers at
> > configure time and turn off the warning.
> > (but that's not trivial to do in a general way) for now you can work
> > it around by using
> >
> > CC='clang -Wno-missing-field-initializers'
> >
> > otoh, the particular code can be written in a better way that avoids
> > the issue entirely (using an operand info pointer instead of a copy),
> > but that's not a good excuse to let the compiler bug slide.


More information about the Binutils mailing list