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]

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 the
> Andrew> -Wmissing-field-initializers warning.  {0} has always been a way to
> Andrew> "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.)

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=3D'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.


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