https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88928

Bernd Edlinger <bernd.edlinger at hotmail dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bernd.edlinger at hotmail dot 
de

--- Comment #2 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
(In reply to H.J. Lu from comment #1)
> We should warn:
> 
> ---
> struct a { int i; } __attribute__((__packed__));
> void c (struct a **);
> void d (const struct a *b) { c ((struct a **) b); }
> --
> 
> But should we warn 
> 
> --
> struct a { } __attribute__((__packed__));
> void c (struct a **);
> void d (const struct a *b) { c ((struct a **) b); }
> --
> 
> in C? Since "struct a" is empty, can we ever generate unaligned access
> to an empty structure?

I think we should warn, because b is aligned(1)
and the code in question passes it to struct a **, which is aligned(8)
which can get an alignment trap.

Reply via email to