public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/106456] New: -Wunreachable-code seems very broken
@ 2022-07-27 14:19 dcb314 at hotmail dot com
  2022-07-27 16:56 ` [Bug c/106456] " pinskia at gcc dot gnu.org
  2022-07-27 16:58 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: dcb314 at hotmail dot com @ 2022-07-27 14:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106456
           Summary: -Wunreachable-code seems very broken
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

I tried out this simple example:

extern void g( int);

int f( int a)
{
        return 2 * a;
        g( a);
}

gcc doesn't seem able to find the problem:

$ /home/dcb/gcc/results/bin/g++ -c -g -O2 -Wall -Wextra -Wunreachable-code
jul27d.cc
$

clang++ can:

$ clang++ -c -g -O2 -Wall -Wextra -Wunreachable-code jul27d.cc
jul27d.cc:7:2: warning: code will never be executed [-Wunreachable-code]
        g( a);
        ^
1 warning generated.
$

Following on from this, there are a couple of examples in the gcc source code:

trunk.git/gcc/value-range-storage.h:149:3: style: Statements following return,
break, continue, goto or throw will never be executed. [unreachableCode]
trunk.git/gcc/value-range-storage.h:210:3: style: Statements following return,
break, continue, goto or throw will never be executed. [unreachableCode]

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

* [Bug c/106456] -Wunreachable-code seems very broken
  2022-07-27 14:19 [Bug c/106456] New: -Wunreachable-code seems very broken dcb314 at hotmail dot com
@ 2022-07-27 16:56 ` pinskia at gcc dot gnu.org
  2022-07-27 16:58 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-07-27 16:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Wunreachable-code
Common Ignore Warning
Does nothing. Preserved for backward compatibility.

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

* [Bug c/106456] -Wunreachable-code seems very broken
  2022-07-27 14:19 [Bug c/106456] New: -Wunreachable-code seems very broken dcb314 at hotmail dot com
  2022-07-27 16:56 ` [Bug c/106456] " pinskia at gcc dot gnu.org
@ 2022-07-27 16:58 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-07-27 16:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 46476.

-Wunreachable-code was removed a long time ago (over 12 years ago) because of
all of the false positives it was generating.

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

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

end of thread, other threads:[~2022-07-27 16:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-27 14:19 [Bug c/106456] New: -Wunreachable-code seems very broken dcb314 at hotmail dot com
2022-07-27 16:56 ` [Bug c/106456] " pinskia at gcc dot gnu.org
2022-07-27 16:58 ` pinskia 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).