Bug 83402 - Creates bogus warnings with '-Wunreachable-code'
Creates bogus warnings with '-Wunreachable-code'
Status: CLOSED CURRENTRELEASE
Product: Red Hat Raw Hide
Classification: Retired
Component: gcc (Show other bugs)
1.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-02-03 17:59 EST by Enrico Scholz
Modified: 2007-04-18 12:50 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-03 08:02:44 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Enrico Scholz 2003-02-03 17:59:24 EST
Description of problem:

-----
$ cat foo.cc
#include <cassert>

struct A
{
    bool	f();
    void	g();

    void	*x;
};

bool
A::f()
{
  return x!=0;
}

void
A::g()
{
  assert(f());
  
  extern volatile int y;
  y = 0;
}

$  g++ -O3 -Wunreachable-code -c foo.cc
foo.cc: In member function `void A::g()':
foo.cc:22: warning: will never be executed

-----

This warning is wrong; it happens also when using 'assert(f() || !f())' but not,
with 'assert(true)' or 'assert(false)' where it would be right.


Version-Release number of selected component (if applicable):

gcc-c++-3.2.1-5
Comment 1 Richard Henderson 2004-10-03 08:02:44 EDT
Fixed with gcc 3.2.3-20.

Note You need to log in before you can comment on or make changes to this bug.