[Bug c++/88897] New: Bogus maybe-uninitialized warning on class field

rafael at espindo dot la gcc-bugzilla@gcc.gnu.org
Thu Jan 17 20:58:00 GMT 2019


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

            Bug ID: 88897
           Summary: Bogus maybe-uninitialized warning on class field
           Product: gcc
           Version: 8.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rafael at espindo dot la
  Target Milestone: ---

Created attachment 45452
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45452&action=edit
testcase

Compiling the attached testcase with "g++ -c -O1 -Wall test.ii" produces

test.ii:631:7: warning: ‘<anonymous>.seastar::temporary_buffer::_buffer’ may be
used uninitialized in this function [-Wmaybe-uninitialized]
 class temporary_buffer {

But in the reduced testcase the only constructor of temporary_buffer is out of
line, so the compiler has no way of knowing if it is initialized or not.

The warning goes away with -O2 or with very minor changes to the source code.


More information about the Gcc-bugs mailing list