Re: arm-none-eabi-gcc: packed attribute causes inefficient alignment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for the response. I will file a bug tracker if that's the case.

I would also like to understand the reasoning behind this warning. When a
struct is packed explicitly it's expected that the padding required for the
alignment of the fields will be removed and it might cause inefficient data
access.
It makes sense to warn when a packed attribute has no effect on struct
layout but I fail to understand why specific fields that are already
aligned in a struct are warned when the whole struct is packed.

Regards,
*Tony*



On Thu, Aug 17, 2023 at 4:56 PM Alexander Monakov <amonakov@xxxxxxxxx>
wrote:

>
> On Thu, 17 Aug 2023, Tony Josi via Gcc-help wrote:
>
> > As per the manual -Wpacked means: Warn when the packed attribute has no
> > effect on struct layout. But in this case the packed attribute does have
> an
> > impact on the struct layout as it removes the padding between ch2 and
> ch3,
> > but still it causes a warning.
>
> The documentation is incomplete, it wasn't updated when -Wpacked started
> diagnosing the situation in your example.
>
> > Though the warning is listed as associated with: -Wattributes.
> > It doesn't show up if -Wpacked is not given as a compile option.
>
> That is inconsistent indeed, would you be willing to report it to
> the bug tracker at https://gcc.gnu.org/bugzilla/ ?
>
> Alexander
>




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux