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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Optimizer issue when        |Optimizer issue when
                   |reinitializing an object of |reinitializing an object of
                   |a standard-layout class     |a standard-layout class
                   |with a trivial copy         |with a trivial copy
                   |constructor and a trivial   |constructor and a trivial
                   |destructor                  |destructor but with padding
                   |                            |bytes

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So your class examples all have padding in it (which you can get a warning with
-Wpadded ).
Once you remove the padding (via adding another field at the end):
```
    int b[4] = {};
    char* p = {};
    int x = {};
    int t = {};
```

The code gets better.

So the big question should padding bytes should be copied or not ...

Reply via email to