[PATCH v2 1/7] libasm: Fix xdefault_pattern initialization
Mark Wielaard
mark@klomp.org
Thu Feb 9 13:14:01 GMT 2023
Hi Ilya,
On Wed, 2023-02-08 at 20:52 +0100, Ilya Leoshkevich wrote:
> clang complains:
>
> asm_newscn.c:48:22: error: field 'pattern' with variable sized type 'struct FillPattern' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
> struct FillPattern pattern;
> ^
>
> Fix by using a union instead. Define the second union member to be a
> char array 1 byte larger than struct FillPattern. This should be legal
> according to 6.7.9:
>
> If an object that has static or thread storage duration is not
> initialized explicitly, then ... if it is a union, the first named
> member is initialized (recursively) according to these rules, and
> any padding is initialized to zero bits.
>
Thanks, pushed.
Mark
More information about the Elfutils-devel
mailing list