Re: [PATCH] unit: pragma test_address to fix GCC warning on musl-libc

Denis Kenzior <[email protected]> Tue, 30 Jul 2024 14:09:10 -0500
Newsgroups dev.linux.lists.ell
Message-ID <[email protected]>
Hi James,

On 7/30/24 11:51 AM, James Prestwood wrote:
> This appears to be a compiler bug causing an array-bounds warning:
> 
> unit/test-rtnl.c: In function 'test_address':
> unit/test-rtnl.c:285:13: error: offset '2305843009213693948' outside bounds of constant string [-Werror=array-bounds]
>    285 | static void test_address(const void *data)
>        |             ^~~~~~~~~~~~
> unit/test-rtnl.c:215:36: note: 'address' declared here
>    215 | static const struct l_rtnl_address address = {
>        |                                    ^~~~~~~
> 
> There is nothing visually wrong with the code, and it appears to be
> having an issue with the "label" member, which is a simple constant
> string. Doing things like adding a member before "label" or making
> "address" not const seems to make it go away, making it really
> appear as if the compiler is confused.
> 
> Fix this by adding a pragma for that test function.
> ---
>   unit/test-rtnl.c | 3 +++
>   1 file changed, 3 insertions(+)
> 

Applied, thanks.

Regards,
-Denis