public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98750] New: does not detect dead code
@ 2021-01-19 18:57 tiagomacarios at gmail dot com
  2021-01-19 19:49 ` [Bug c++/98750] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: tiagomacarios at gmail dot com @ 2021-01-19 18:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98750
           Summary: does not detect dead code
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tiagomacarios at gmail dot com
  Target Milestone: ---

for the following code gcc will not detect that f() is never called. msvc
detects this correctly.

https://godbolt.org/z/Y5n78v
```
void f();

void _(int num) {
    switch (num)
    {
        case 1:
            break;
            f();
    }
}
```

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

* [Bug c++/98750] does not detect dead code
  2021-01-19 18:57 [Bug c++/98750] New: does not detect dead code tiagomacarios at gmail dot com
@ 2021-01-19 19:49 ` redi at gcc dot gnu.org
  2021-01-20  7:56 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2021-01-19 19:49 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
GCC doesn't emit any call to f() so it does detect it. Do you mean that it
doesn't give a warning?

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

* [Bug c++/98750] does not detect dead code
  2021-01-19 18:57 [Bug c++/98750] New: does not detect dead code tiagomacarios at gmail dot com
  2021-01-19 19:49 ` [Bug c++/98750] " redi at gcc dot gnu.org
@ 2021-01-20  7:56 ` marxin at gcc dot gnu.org
  2021-01-20 20:59 ` tiagomacarios at gmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-01-20  7:56 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
                 CC|                            |marxin at gcc dot gnu.org
   Last reconfirmed|                            |2021-01-20
     Ever confirmed|0                           |1

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

* [Bug c++/98750] does not detect dead code
  2021-01-19 18:57 [Bug c++/98750] New: does not detect dead code tiagomacarios at gmail dot com
  2021-01-19 19:49 ` [Bug c++/98750] " redi at gcc dot gnu.org
  2021-01-20  7:56 ` marxin at gcc dot gnu.org
@ 2021-01-20 20:59 ` tiagomacarios at gmail dot com
  2021-01-21 10:18 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tiagomacarios at gmail dot com @ 2021-01-20 20:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tiago Macarios <tiagomacarios at gmail dot com> ---
Correct. I was expecting a warning there.

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

* [Bug c++/98750] does not detect dead code
  2021-01-19 18:57 [Bug c++/98750] New: does not detect dead code tiagomacarios at gmail dot com
                   ` (2 preceding siblings ...)
  2021-01-20 20:59 ` tiagomacarios at gmail dot com
@ 2021-01-21 10:18 ` redi at gcc dot gnu.org
  2021-08-17  9:05 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2021-01-21 10:18 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|1                           |0
             Status|WAITING                     |UNCONFIRMED

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
GCC's -Wunreachable was removed years ago.

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

* [Bug c++/98750] does not detect dead code
  2021-01-19 18:57 [Bug c++/98750] New: does not detect dead code tiagomacarios at gmail dot com
                   ` (3 preceding siblings ...)
  2021-01-21 10:18 ` redi at gcc dot gnu.org
@ 2021-08-17  9:05 ` pinskia at gcc dot gnu.org
  2021-10-27  5:08 ` [Bug c++/98750] does not detect dead code [-Wunreachable-code-break] egallager at gcc dot gnu.org
  2021-11-24 19:06 ` egallager at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-17  9:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|2021-01-20 00:00:00         |2021-08-17
             Status|UNCONFIRMED                 |NEW
           Severity|normal                      |enhancement
         Depends on|                            |46476

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Basically PR 46476 but for break instead of return.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46476
[Bug 46476] Missing Warning about unreachable code after return
[-Wunreachable-code-return]

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

* [Bug c++/98750] does not detect dead code [-Wunreachable-code-break]
  2021-01-19 18:57 [Bug c++/98750] New: does not detect dead code tiagomacarios at gmail dot com
                   ` (4 preceding siblings ...)
  2021-08-17  9:05 ` pinskia at gcc dot gnu.org
@ 2021-10-27  5:08 ` egallager at gcc dot gnu.org
  2021-11-24 19:06 ` egallager at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: egallager at gcc dot gnu.org @ 2021-10-27  5:08 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|does not detect dead code   |does not detect dead code
                   |                            |[-Wunreachable-code-break]
             Blocks|                            |87403
                 CC|                            |egallager at gcc dot gnu.org

--- Comment #5 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #4)
> Basically PR 46476 but for break instead of return.

As mentioned in that bug (bug 46476 comment 10), clang puts them under separate
flags, so I'm having this block the "new-warning" meta-bug


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87403
[Bug 87403] [Meta-bug] Issues that suggest a new warning

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

* [Bug c++/98750] does not detect dead code [-Wunreachable-code-break]
  2021-01-19 18:57 [Bug c++/98750] New: does not detect dead code tiagomacarios at gmail dot com
                   ` (5 preceding siblings ...)
  2021-10-27  5:08 ` [Bug c++/98750] does not detect dead code [-Wunreachable-code-break] egallager at gcc dot gnu.org
@ 2021-11-24 19:06 ` egallager at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: egallager at gcc dot gnu.org @ 2021-11-24 19:06 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Gallager <egallager at gcc dot gnu.org> changed:

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

--- Comment #6 from Eric Gallager <egallager at gcc dot gnu.org> ---
actually this is a dup of bug 92479

*** This bug has been marked as a duplicate of bug 92479 ***

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

end of thread, other threads:[~2021-11-24 19:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19 18:57 [Bug c++/98750] New: does not detect dead code tiagomacarios at gmail dot com
2021-01-19 19:49 ` [Bug c++/98750] " redi at gcc dot gnu.org
2021-01-20  7:56 ` marxin at gcc dot gnu.org
2021-01-20 20:59 ` tiagomacarios at gmail dot com
2021-01-21 10:18 ` redi at gcc dot gnu.org
2021-08-17  9:05 ` pinskia at gcc dot gnu.org
2021-10-27  5:08 ` [Bug c++/98750] does not detect dead code [-Wunreachable-code-break] egallager at gcc dot gnu.org
2021-11-24 19:06 ` egallager 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).