public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/109339] [12/13 Regression] stop_token compiled with -Og yields maybe-uninitialized
Date: Fri, 31 Mar 2023 09:58:20 +0000	[thread overview]
Message-ID: <bug-109339-4-JjH1etRpRx@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109339-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #4)
> (In reply to Richard Biener from comment #2)
> > The diagnostic is intentional I think.  We see
> > 
> > <bb 2> [local count: 1073741824]:
> > ss ={v} {CLOBBER};
> > std::stop_token::_Stop_state_ref::_Stop_state_ref (&ss._M_state, &ss);
> > std::stop_source::~stop_source (&ss);
> > ss ={v} {CLOBBER(eol)};
> > return 0;
> > 
> > and the call to _Stop_state_ref passes references to uninitialized 'ss'
> > (tree-ssa-uninit.cc:maybe_warn_pass_by_reference).  The &ss argument
> > is a const reference and the function does
> > 
> >       _Stop_state_ref(const _Stop_state_ref& __other) noexcept
> 
> That function is never used in this code though. Why is code being emitted
> for it?

Actually I don't think any code is being emitted for it, so that's fine. That
function is a red herring, but not involved here at all.

The warning is for this one:

> We don't copy a _Stop_state_ref, we construct one using this constructor:
> 
>       _Stop_state_ref(const stop_source&)
>       : _M_ptr(new _Stop_state_t())
>       { }
> 
> This has a reference to ss but doesn't inspect it at all.

It can't inspect it, because it's not even named. The function has no way to
possibly access the uninitialized object through that reference.

  parent reply	other threads:[~2023-03-31  9:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 19:43 [Bug c++/109339] New: " gcc at heine dot tech
2023-03-29 20:22 ` [Bug c++/109339] " redi at gcc dot gnu.org
2023-03-29 20:26 ` [Bug c++/109339] [12/13 Regression] " redi at gcc dot gnu.org
2023-03-30  7:39 ` [Bug libstdc++/109339] " rguenth at gcc dot gnu.org
2023-03-30  7:44 ` rguenth at gcc dot gnu.org
2023-03-30  7:44 ` rguenth at gcc dot gnu.org
2023-03-31  9:52 ` redi at gcc dot gnu.org
2023-03-31  9:58 ` redi at gcc dot gnu.org [this message]
2023-03-31 11:17 ` rguenth at gcc dot gnu.org
2023-03-31 11:31 ` redi at gcc dot gnu.org
2023-03-31 11:58 ` jakub at gcc dot gnu.org
2023-03-31 12:12 ` redi at gcc dot gnu.org
2023-03-31 12:17 ` jakub at gcc dot gnu.org
2023-03-31 12:39 ` redi at gcc dot gnu.org
2023-03-31 14:50 ` cvs-commit at gcc dot gnu.org
2023-04-01  9:54 ` [Bug libstdc++/109339] [12 " jakub at gcc dot gnu.org
2023-04-27 14:43 ` cvs-commit at gcc dot gnu.org
2023-04-27 14:44 ` redi 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-109339-4-JjH1etRpRx@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).