public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95516] New: [coroutines] incorrect warning "'coro.gro' is used uninitialized"
@ 2020-06-03 21:05 bruck.michael at gmail dot com
  2020-06-04 19:17 ` [Bug c++/95516] " iains at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: bruck.michael at gmail dot com @ 2020-06-03 21:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95516
           Summary: [coroutines] incorrect warning "'coro.gro' is used
                    uninitialized"
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bruck.michael at gmail dot com
  Target Milestone: ---

#include <coroutine>

struct dummy
{
    struct promise_type
    {
        dummy get_return_object() const noexcept { return {}; }
        std::suspend_never initial_suspend() const noexcept { return {}; }
        std::suspend_never final_suspend() const noexcept { return {}; }
        void return_void() const noexcept {}
        void unhandled_exception() const noexcept {}
    };
    // int i; // this kills the warning
};

dummy foo()
{ 
    co_return;
}

int main()
{
    foo();
}
---

<source>: In function 'dummy foo()':
<source>:19:1: warning: 'coro.gro' is used uninitialized in this function
[-Wuninitialized]
   19 | }
      | ^

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

* [Bug c++/95516] [coroutines] incorrect warning "'coro.gro' is used uninitialized"
  2020-06-03 21:05 [Bug c++/95516] New: [coroutines] incorrect warning "'coro.gro' is used uninitialized" bruck.michael at gmail dot com
@ 2020-06-04 19:17 ` iains at gcc dot gnu.org
  2020-06-04 21:04 ` bruck.michael at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: iains at gcc dot gnu.org @ 2020-06-04 19:17 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-06-04
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Iain Sandoe <iains at gcc dot gnu.org> ---
Thanks for the report.

this is a kinda tricky situation;
I have also seen this occur (in larger test cases)

1) the coro.gro variable is an internal one to the compiler (it is also marked
as such). So the user can't "fix" the problem...

2) coro.gro is always initialised unconditionally in the same fragment of code
that creates it.

so it seems a false positive (actually, the example code posted here does not
fail for me on either 10.x or master) - however, as noted, I have seen this
occur.

- so this is a problem with the subsequent diagnostics processing or
optimisation.

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

* [Bug c++/95516] [coroutines] incorrect warning "'coro.gro' is used uninitialized"
  2020-06-03 21:05 [Bug c++/95516] New: [coroutines] incorrect warning "'coro.gro' is used uninitialized" bruck.michael at gmail dot com
  2020-06-04 19:17 ` [Bug c++/95516] " iains at gcc dot gnu.org
@ 2020-06-04 21:04 ` bruck.michael at gmail dot com
  2020-06-06 19:41 ` iains at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: bruck.michael at gmail dot com @ 2020-06-04 21:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Michael Bruck <bruck.michael at gmail dot com> ---
I was using -Ofast -Wall:
https://gcc.godbolt.org/z/pAkVS8

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

* [Bug c++/95516] [coroutines] incorrect warning "'coro.gro' is used uninitialized"
  2020-06-03 21:05 [Bug c++/95516] New: [coroutines] incorrect warning "'coro.gro' is used uninitialized" bruck.michael at gmail dot com
  2020-06-04 19:17 ` [Bug c++/95516] " iains at gcc dot gnu.org
  2020-06-04 21:04 ` bruck.michael at gmail dot com
@ 2020-06-06 19:41 ` iains at gcc dot gnu.org
  2020-06-06 20:45 ` iains at gcc dot gnu.org
  2020-06-30 12:55 ` iains at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: iains at gcc dot gnu.org @ 2020-06-06 19:41 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |iains at gcc dot gnu.org
   Target Milestone|---                         |10.2

--- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Michael Bruck from comment #2)
> I was using -Ofast -Wall:
> https://gcc.godbolt.org/z/pAkVS8

I can repeat it with -Ofast.
[this still might have nothing to do with coroutines, but rather the tracking
of var usage, since the complaint is in the ramp function (which is a regular
c++ function)]

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

* [Bug c++/95516] [coroutines] incorrect warning "'coro.gro' is used uninitialized"
  2020-06-03 21:05 [Bug c++/95516] New: [coroutines] incorrect warning "'coro.gro' is used uninitialized" bruck.michael at gmail dot com
                   ` (2 preceding siblings ...)
  2020-06-06 19:41 ` iains at gcc dot gnu.org
@ 2020-06-06 20:45 ` iains at gcc dot gnu.org
  2020-06-30 12:55 ` iains at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: iains at gcc dot gnu.org @ 2020-06-06 20:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Iain Sandoe from comment #3)
> (In reply to Michael Bruck from comment #2)
> > I was using -Ofast -Wall:
> > https://gcc.godbolt.org/z/pAkVS8
> 
> I can repeat it with -Ofast.
> [this still might have nothing to do with coroutines, but rather the
> tracking of var usage, since the complaint is in the ramp function (which is
> a regular c++ function)]

... and now it's gone again ...

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

* [Bug c++/95516] [coroutines] incorrect warning "'coro.gro' is used uninitialized"
  2020-06-03 21:05 [Bug c++/95516] New: [coroutines] incorrect warning "'coro.gro' is used uninitialized" bruck.michael at gmail dot com
                   ` (3 preceding siblings ...)
  2020-06-06 20:45 ` iains at gcc dot gnu.org
@ 2020-06-30 12:55 ` iains at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: iains at gcc dot gnu.org @ 2020-06-30 12:55 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WORKSFORME
             Status|NEW                         |RESOLVED

--- Comment #5 from Iain Sandoe <iains at gcc dot gnu.org> ---
I cannot reproduce this any more, it would seem that the reorganisation of the
g-r-o and return code has made this false-positive disappear.

This test case is in my regular "additional" testing and it has not fired for
weeks.

please reopen if there's a repeatable case

in my opinion, user should not be presented with such warnings (when they can't
fix them - but that's a separate discussion).

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

end of thread, other threads:[~2020-06-30 12:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 21:05 [Bug c++/95516] New: [coroutines] incorrect warning "'coro.gro' is used uninitialized" bruck.michael at gmail dot com
2020-06-04 19:17 ` [Bug c++/95516] " iains at gcc dot gnu.org
2020-06-04 21:04 ` bruck.michael at gmail dot com
2020-06-06 19:41 ` iains at gcc dot gnu.org
2020-06-06 20:45 ` iains at gcc dot gnu.org
2020-06-30 12:55 ` iains 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).