[Bug c++/92722] gcc considers "padding" byte of empty lambda to be uninitialized

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Nov 29 07:22:00 GMT 2019


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic,
                   |                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-11-29
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
It clearly copies an uninitialized 'char'.  The middle-end doesn't know this is
padding (or even what padding is), so you have to work around this in the C++
source somehow.

At least I cannot even see how the C++ FE could mark those accesses with
TREE_NO_WARNING because even the FE doesn't see we are accessing padding.

Maybe all std::copy/move/etc. should do nothing for "empty" types.

It's also a missed optimization of course.


More information about the Gcc-bugs mailing list