--- Comment #5 from Martin Sebor <msebor at gcc dot> ---
(In reply to Arnd Bergmann from comment #3)
> Two other variations of this warning that I ran into are slightly different:
> fs/ubifs/ubifs-media.h and include/scsi/libsas.h define a structure with
> __attribute__((packed)) and use that structure as a member in another
> structure, with that member being marked __attribute__((aligned)). I would
> hope that this behavior has never changed.

I don't see these in my build.  Are they variants of -Wattributes or is it
actually -Wpacked-not-aligned?

Here's a test case based my understanding of your description.  The warning is
new in GCC 8 but there is no change in alignment as a result.  If I
misunderstood or if you see something different, can you please reduce it or
attach the translation unit?

$ cat a.c && gcc -S -Wall a.c
struct __attribute__ ((aligned (32))) A { char a[32]; };

struct __attribute__ ((packed)) B
  struct A a;   // -Wpacked-not-aligned: alignment 1 of ‘struct B’ is less than
} b;

_Static_assert (_Alignof (b.a) == 1, "assert b.a is packed");

a.c:6:1: warning: alignment 1 of ‘struct B’ is less than 32
 } b;

Reply via email to