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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egallager at gcc dot gnu.org
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=93910,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=92900,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=68160,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=60972

--- Comment #12 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Rene Rahn from comment #10)
> I know this is quite old now. But can someone explain me why using `#pragma
> pack(push, 1)` does work then? I couldn't find enough resources on that. The
> only thing I found is, that it does literally the same. But wouldn't then
> the references/pointers still not be valid?
> 
> So if I change the code to:
> 
> ```
> #pragma pack(push, 1)
> struct Squeeze
> {
>     short   s;
> };
> #pragma pack(pop)
> ```
> 
> Then it works on godbolt with gcc-trunk.

There are several bugs open about inconsistencies between
__attribute__((packed)) and #pragma pack; see for example: bug 93910, bug
92900, bug 68160, and bug 60972

Reply via email to