public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109339] New: stop_token compiled with -Og yields maybe-uninitialized
@ 2023-03-29 19:43 gcc at heine dot tech
  2023-03-29 20:22 ` [Bug c++/109339] " redi at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: gcc at heine dot tech @ 2023-03-29 19:43 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109339
           Summary: stop_token compiled with -Og yields
                    maybe-uninitialized
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at heine dot tech
  Target Milestone: ---

This happens since gcc 12.

This snippet compiled with -std=c++20 -Og -Wmaybe-uninitialized

```
#include <stop_token>

int main() {
    std::stop_source ss;
}
```

yields this warning

```
In constructor 'std::stop_source::stop_source()',
    inlined from 'int main()' at <source>:4:22:
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/stop_token:480:21:
warning: 'ss' may be used uninitialized [-Wmaybe-uninitialized]
  480 |     stop_source() : _M_state(*this)
      |                     ^~~~~~~~~~~~~~~
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/stop_token: In function
'int main()':
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/stop_token:397:7: note: by
argument 2 of type 'const std::stop_source&' to
'std::stop_token::_Stop_state_ref::_Stop_state_ref(const std::stop_source&)'
declared here
  397 |       _Stop_state_ref(const stop_source&)
      |       ^~~~~~~~~~~~~~~
<source>:4:22: note: 'ss' declared here
    4 |     std::stop_source ss;
      |                      ^~
```

Godbolt: https://godbolt.org/z/KofErdEzY

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2023-04-27 14:44 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29 19:43 [Bug c++/109339] New: stop_token compiled with -Og yields maybe-uninitialized 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
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

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).