public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/24968]  New: wrong "will never be executed" warning
@ 2005-11-21 12:09 oliverst at online dot de
  2005-11-21 13:17 ` [Bug middle-end/24968] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: oliverst at online dot de @ 2005-11-21 12:09 UTC (permalink / raw)
  To: gcc-bugs

The following source will report

C:\Dev-Cpp\Projects\test-stlport\main_17.cpp In function `void test_17()': 
12 C:\Dev-Cpp\Projects\test-stlport\main_17.cpp [Warning] will never be
executed
12 C:\Dev-Cpp\Projects\test-stlport\main_17.cpp [Warning] will never be
executed

when using "-Wunreachable-code"

I reduced this from a way bigger source file with STL and even more if - else
involved and this was the only two warnings from the beginning (whole file) to
the end (this sample). Happens with C and C++.

void test_17()
{
        int pos = 1; 
        while(1) {
                if ( pos )
                {
                        if ( pos == 2 ) /* */
                        {
                        }
                        else
                        {
                                break;
                        }
                }
                else
                {
                        break;
                }
        }
}

C:\MinGW_3.4.4\bin>gcc -v
Reading specs from ../lib/gcc/mingw32/3.4.4/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as
--host=
mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls
--enable
-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared
--e
nable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x
--enable-ja
va-gc=boehm --disable-libgcj-debug --enable-interpreter
--enable-hash-synchroniz
ation --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.4 (mingw special)


-- 
           Summary: wrong "will never be executed" warning
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: oliverst at online dot de


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


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

* [Bug middle-end/24968] wrong "will never be executed" warning
  2005-11-21 12:09 [Bug c/24968] New: wrong "will never be executed" warning oliverst at online dot de
@ 2005-11-21 13:17 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-21 13:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-11-21 13:17 -------
Fixed for 4.0.0.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.0


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


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

end of thread, other threads:[~2005-11-21 13:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-21 12:09 [Bug c/24968] New: wrong "will never be executed" warning oliverst at online dot de
2005-11-21 13:17 ` [Bug middle-end/24968] " pinskia at gcc dot gnu dot 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).