public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/43346]  New: -Wunreachable-code incorrect warning
@ 2010-03-12 12:29 jiri dot engelthaler at zat dot cz
  2010-03-12 12:31 ` [Bug c++/43346] " jiri dot engelthaler at zat dot cz
  0 siblings, 1 reply; 2+ messages in thread
From: jiri dot engelthaler at zat dot cz @ 2010-03-12 12:29 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]

By adding a destructor to main class to example in the bug 21228
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21228) will produce incorrect
warning about code that "will never be executed"

# g++  -Wunreachable-code gstest.cpp
gstest.cpp: In constructor ‘testString::testString()’:
gstest.cpp:24: warning: will never be executed
gstest.cpp: In constructor ‘testString::testString()’:
gstest.cpp:24: warning: will never be executed

#cat gstest.cpp
// #include <stdio.h>

class testStringBase
{
public:
  ~testStringBase();
  char *stringPtr;
};

testStringBase::~testStringBase()
{
  stringPtr = 0;
}

class testString : public testStringBase
{
public:
  testString();
};

testString::testString()
{
  stringPtr = (char *) 9;
}

int main(int argc, char **argv) {
  testString s;
  //  printf("s.stringPtr is %ld\n", (unsigned long) s.stringPtr);
}


-- 
           Summary: -Wunreachable-code incorrect warning
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jiri dot engelthaler at zat dot cz


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43346


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

* [Bug c++/43346] -Wunreachable-code incorrect warning
  2010-03-12 12:29 [Bug c++/43346] New: -Wunreachable-code incorrect warning jiri dot engelthaler at zat dot cz
@ 2010-03-12 12:31 ` jiri dot engelthaler at zat dot cz
  0 siblings, 0 replies; 2+ messages in thread
From: jiri dot engelthaler at zat dot cz @ 2010-03-12 12:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jiri dot engelthaler at zat dot cz  2010-03-12 12:31 -------
Duplicate bug with 43344


-- 

jiri dot engelthaler at zat dot cz changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID
            Summary|-Wunreachable-code incorrect|-Wunreachable-code incorrect
                   |warning                     |warning


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43346


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

end of thread, other threads:[~2010-03-12 12:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-12 12:29 [Bug c++/43346] New: -Wunreachable-code incorrect warning jiri dot engelthaler at zat dot cz
2010-03-12 12:31 ` [Bug c++/43346] " jiri dot engelthaler at zat dot cz

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).