Re: [U-Boot] [BUG] net: nfs: -Werror=address-of-packed-member

2019-09-03 Thread Heinrich Schuchardt

On 9/3/19 11:32 PM, Joe Hershberger wrote:

Hi Heinrich,

On Mon, Sep 2, 2019 at 4:39 PM Heinrich Schuchardt  wrote:


Hello Joe,

GCC 9.2.1 (of Debian Bullseye) produces the warnings below when building
pine64-lts_defconfig. Is it really necessary to define struct rpc_t as
packed? The structure is composed out of uint32_t only. So shouldn't it
be naturally packed without the attribute?


I guess this won't cause problems on 64-bit with the union sharing
memory, right?


The addresses of all members of a union is the same. See C99 standard
6.2.7.1, paragraph 14.

The alignment requirement on an array is not stricter than on its
elements. Anyway the arrays in the union start at a multiple of 64bit
after the start of the structure.

Both on x86_64 and on arm64  is 24 bytes after  without
'packed' - just where you would expect it.

Best regards

Heinrich






net/nfs.c: In function ‘rpc_req’:
net/nfs.c:199:18: error: taking address of packed member of ‘struct
rpc_t’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
199 |  p = (uint32_t *)&(rpc_pkt.u.call.data);
|  ^~
net/nfs.c: In function ‘nfs_readlink_reply’:
net/nfs.c:631:46: error: taking address of packed member of ‘struct
rpc_t’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
631 |nfs3_get_attributes_offset(rpc_pkt.u.reply.data);
|   ~~~^
LD  drivers/block/built-in.o
net/nfs.c: In function ‘nfs_read_reply’:
net/nfs.c:692:46: error: taking address of packed member of ‘struct
rpc_t’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
692 |nfs3_get_attributes_offset(rpc_pkt.u.reply.data);
|   ~~~^

Best regards

Heinrich
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [BUG] net: nfs: -Werror=address-of-packed-member

2019-09-03 Thread Joe Hershberger
Hi Heinrich,

On Mon, Sep 2, 2019 at 4:39 PM Heinrich Schuchardt  wrote:
>
> Hello Joe,
>
> GCC 9.2.1 (of Debian Bullseye) produces the warnings below when building
> pine64-lts_defconfig. Is it really necessary to define struct rpc_t as
> packed? The structure is composed out of uint32_t only. So shouldn't it
> be naturally packed without the attribute?

I guess this won't cuase problems on 64-bit with the union sharing
memory, right?

>
> net/nfs.c: In function ‘rpc_req’:
> net/nfs.c:199:18: error: taking address of packed member of ‘struct
> rpc_t’ may result in an unaligned pointer value
> [-Werror=address-of-packed-member]
>199 |  p = (uint32_t *)&(rpc_pkt.u.call.data);
>|  ^~
> net/nfs.c: In function ‘nfs_readlink_reply’:
> net/nfs.c:631:46: error: taking address of packed member of ‘struct
> rpc_t’ may result in an unaligned pointer value
> [-Werror=address-of-packed-member]
>631 |nfs3_get_attributes_offset(rpc_pkt.u.reply.data);
>|   ~~~^
>LD  drivers/block/built-in.o
> net/nfs.c: In function ‘nfs_read_reply’:
> net/nfs.c:692:46: error: taking address of packed member of ‘struct
> rpc_t’ may result in an unaligned pointer value
> [-Werror=address-of-packed-member]
>692 |nfs3_get_attributes_offset(rpc_pkt.u.reply.data);
>|   ~~~^
>
> Best regards
>
> Heinrich
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [BUG] net: nfs: -Werror=address-of-packed-member

2019-09-02 Thread Heinrich Schuchardt

Hello Joe,

GCC 9.2.1 (of Debian Bullseye) produces the warnings below when building
pine64-lts_defconfig. Is it really necessary to define struct rpc_t as
packed? The structure is composed out of uint32_t only. So shouldn't it
be naturally packed without the attribute?

net/nfs.c: In function ‘rpc_req’:
net/nfs.c:199:18: error: taking address of packed member of ‘struct
rpc_t’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  199 |  p = (uint32_t *)&(rpc_pkt.u.call.data);
  |  ^~
net/nfs.c: In function ‘nfs_readlink_reply’:
net/nfs.c:631:46: error: taking address of packed member of ‘struct
rpc_t’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  631 |nfs3_get_attributes_offset(rpc_pkt.u.reply.data);
  |   ~~~^
  LD  drivers/block/built-in.o
net/nfs.c: In function ‘nfs_read_reply’:
net/nfs.c:692:46: error: taking address of packed member of ‘struct
rpc_t’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  692 |nfs3_get_attributes_offset(rpc_pkt.u.reply.data);
  |   ~~~^

Best regards

Heinrich
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot