public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/109448] [12/13 Regression] wrong uninitialized warning with std::variant of an empty class and std::exception_ptr
Date: Sat, 08 Apr 2023 22:09:52 +0000	[thread overview]
Message-ID: <bug-109448-4-4NIN2puUsy@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109448-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|_M_exception_object’ may be |[12/13 Regression] wrong
                   |used uninitialized          |uninitialized warning with
                   |[-Werror=maybe-uninitialize |std::variant of an empty
                   |d]                          |class and
                   |                            |std::exception_ptr
   Target Milestone|---                         |12.3
      Known to fail|                            |12.1.0
      Known to work|                            |11.3.0

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced further:
```
#include <variant>
#include <cassert>
#include <exception>
#include <atomic>
struct Empty {};

struct Try {
    Try() = default;
    ~Try() = default;
    Try(Empty a): _value(a){}
    Try(Try&& other) = default;
    Try& operator=(Try&& other) = default;
    std::variant<Empty, std::exception_ptr> _value;
};

struct TestPromise {
    void setResult(Try&& value) {
        if(_state != 0) __builtin_abort();
        _try_value = std::move(value);
    }
    std::atomic<int> _state = 0;
    Try _try_value;
};


int main() {
  TestPromise promise;
  promise.setResult(Empty());
}
```

  parent reply	other threads:[~2023-04-08 22:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-08  5:10 [Bug c++/109448] New: _M_exception_object’ may be used uninitialized [-Werror=maybe-uninitialized] jincikang at gmail dot com
2023-04-08  5:14 ` [Bug c++/109448] " jincikang at gmail dot com
2023-04-08 22:09 ` pinskia at gcc dot gnu.org [this message]
2023-04-12 13:17 ` [Bug tree-optimization/109448] [12/13 Regression] wrong uninitialized warning with std::variant of an empty class and std::exception_ptr rguenth at gcc dot gnu.org
2023-05-08 12:26 ` [Bug tree-optimization/109448] [12/13/14 " rguenth at gcc dot gnu.org
2024-06-20  9:12 ` [Bug tree-optimization/109448] [12/13/14/15 " rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109448-4-4NIN2puUsy@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).