public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/104415] New: uninit diagnostic improvement at -O0
@ 2022-02-07 10:10 rguenth at gcc dot gnu.org
  2022-02-07 10:10 ` [Bug tree-optimization/104415] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-07 10:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104415
           Summary: uninit diagnostic improvement at -O0
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

For

int foo ()
{
  int cond = 1;
  int tem;
  return cond ? tem : 0;
}

we emit

t.c: In function 'foo':
t.c:5:21: warning: 'tem' may be used uninitialized [-Wmaybe-uninitialized]
    5 |   return cond ? tem : 0;
      |          ~~~~~~~~~~~^~~
t.c:4:7: note: 'tem' was declared here
    4 |   int tem;
      |       ^~~

when not optimizing but

t.c: In function 'foo':
t.c:5:21: warning: 'tem' is used uninitialized [-Wuninitialized]
    5 |   return cond ? tem : 0;
      |          ~~~~~~~~~~~^~~
t.c:4:7: note: 'tem' was declared here
    4 |   int tem;
      |       ^~~

when optimizing.  Even when not optimizing we could figure out the condition
is constant and emit the "is used uninitialized" variant.

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

* [Bug tree-optimization/104415] uninit diagnostic improvement at -O0
  2022-02-07 10:10 [Bug tree-optimization/104415] New: uninit diagnostic improvement at -O0 rguenth at gcc dot gnu.org
@ 2022-02-07 10:10 ` rguenth at gcc dot gnu.org
  2022-02-07 20:35 ` pinskia at gcc dot gnu.org
  2022-02-10 11:52 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-07 10:10 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |104373

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
PR104373 mentions how this can be improved.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104373
[Bug 104373] [12 regression] bogus -Wmaybe-uninitialized warning with array new

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

* [Bug tree-optimization/104415] uninit diagnostic improvement at -O0
  2022-02-07 10:10 [Bug tree-optimization/104415] New: uninit diagnostic improvement at -O0 rguenth at gcc dot gnu.org
  2022-02-07 10:10 ` [Bug tree-optimization/104415] " rguenth at gcc dot gnu.org
@ 2022-02-07 20:35 ` pinskia at gcc dot gnu.org
  2022-02-10 11:52 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-07 20:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-02-07
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug tree-optimization/104415] uninit diagnostic improvement at -O0
  2022-02-07 10:10 [Bug tree-optimization/104415] New: uninit diagnostic improvement at -O0 rguenth at gcc dot gnu.org
  2022-02-07 10:10 ` [Bug tree-optimization/104415] " rguenth at gcc dot gnu.org
  2022-02-07 20:35 ` pinskia at gcc dot gnu.org
@ 2022-02-10 11:52 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-10 11:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104415
Bug 104415 depends on bug 104373, which changed state.

Bug 104373 Summary: [12 regression] bogus -Wmaybe-uninitialized warning with array new
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104373

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

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

end of thread, other threads:[~2022-02-10 11:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-07 10:10 [Bug tree-optimization/104415] New: uninit diagnostic improvement at -O0 rguenth at gcc dot gnu.org
2022-02-07 10:10 ` [Bug tree-optimization/104415] " rguenth at gcc dot gnu.org
2022-02-07 20:35 ` pinskia at gcc dot gnu.org
2022-02-10 11:52 ` rguenth 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).