Bug 83402 - Creates bogus warnings with '-Wunreachable-code'
Summary: Creates bogus warnings with '-Wunreachable-code'
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: gcc (Show other bugs)
(Show other bugs)
Version: 1.0
Hardware: All Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-02-03 22:59 UTC by Enrico Scholz
Modified: 2007-04-18 16:50 UTC (History)
0 users

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


Attachments (Terms of Use)

Description Enrico Scholz 2003-02-03 22:59:24 UTC
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 12:02:44 UTC
Fixed with gcc 3.2.3-20.


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