[Bug middle-end/88897] Bogus maybe-uninitialized warning on class field (missed CSE)

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 6 20:35:36 GMT 2021


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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org
      Known to fail|                            |10.2.0, 11.0, 8.3.0, 9.3.0
   Last reconfirmed|2019-01-22 00:00:00         |2021-4-6

--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
The IL hasn't appreciably changed in GCC 11 so it still issues the warning,
albeit with more detail.

$ gcc -O2 -S -Wall pr88897.C
In constructor ‘temporary_buffer::temporary_buffer(temporary_buffer&&)’,
    inlined from ‘optional::optional(optional&&)’ at pr88897.C:22:79,
    inlined from ‘void foo()’ at pr88897.C:42:57:
pr88897.C:14:63: warning: ‘*(temporary_buffer*)((char*)&_local_state +
offsetof(future_state,
future_state::value.optional::<unnamed>)).temporary_buffer::_buffer’ may be
used uninitialized [-Wmaybe-uninitialized]
   14 |  temporary_buffer(temporary_buffer &&x) noexcept : _buffer(x._buffer) {
      |                                                            ~~^~~~~~~

pr88897.C: In function ‘void foo()’:
pr88897.C:40:16: note: ‘_local_state’ declared here
   40 |   future_state _local_state;
      |                ^~~~~~~~~~~~


More information about the Gcc-bugs mailing list