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

            Bug ID: 94992
           Summary: gcc thinks a member variable is uninitialised
           Product: gcc
           Version: 10.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rafael at espindo dot la
  Target Milestone: ---

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

In the attached testcase gcc with -O1 (but not -O0 or -O2) produces the
following warning

futures_test.cc:57:22: warning: ‘f2.my_future::_promise’ is used uninitialized
in this function [-Wuninitialized]
   57 |         : _promise(x._promise)

The produced assembly also uses uninitialized memory.

The problem is that _promise is initialized to nullptr in the default
constructor.

Reply via email to