[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#487078: marked as done (warning: will never be executed)



Your message dated Tue, 20 Dec 2011 14:40:57 +0100
with message-id <4EF09069.9030206@debian.org>
and subject line not seen with g++-4.6
has caused the Debian Bug report #487078,
regarding warning: will never be executed
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
487078: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=487078
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: libstdc++6
Version: 4.1.1-21

When compiling programs which use "/usr/include/c++/4.1.2/bits/streambuf_iterator.h" with gcc, and including the flag "-Wunreachable-code", the compiler informs me that the header file contains unreachable code. Now I know this is not an "error", but maybe one could optimize the code found in the header based on the compilers suggestions.

I am using:
Linux 2.6.18-6-686 i686 GNU/Linux (Debian Etch)

Sample code (taken from "http://www2.roguewave.com/support/docs/leif/sourcepro/html/stdlibref/istreambuf-iterator.html";):

//
//  istreambuf_iterator.cpp
//
 
#include <iostream>   // for cout, endl
#include <fstream>    // for ofstream, istreambuf_iterator

#include <stdio.h>    // for tmpnam () and remove ()

int main ( )
{
    // create a temporary filename
    const char *fname = tmpnam (0);

    if (!fname)
        return 1;

    // open the file is_iter.out for reading and writing
    std::ofstream out (fname, std::ios::out | std::ios::in |
                              std::ios::trunc);

    // output the example sentence into the file
    out << "Ceci est un simple exemple pour démontrer le\n"
           "fonctionnement de istreambuf_iterator.";

    // seek to the beginning of the file
    out.seekp (0);

    // construct an istreambuf_iterator pointing to
    // the ofstream object underlying streambuffer
    std::istreambuf_iterator<char, std::char_traits<char> >
                             iter (out.rdbuf ());

    // construct an end of stream iterator
    const std::istreambuf_iterator<char,
                                   std::char_traits<char> > end;

    std::cout << std::endl;

    // output the content of the file
    while (!iter.equal (end)) {

        // use both operator++ and operator*
        std::cout << *iter++;
    }

    std::cout << std::endl;

    // remove temporary file
    remove (fname);

    return 0;
}

Sample compiling run:

g++ -Wunreachable-code -o prog main.cpp
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/fstream: In constructor &#8216;std::basic_ofstream<_CharT, _Traits>::basic_ofstream(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>]&#8217;:
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/fstream:573: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/fstream:573: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/fstream:573: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/fstream:573: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/fstream:575: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/fstream:576: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/basic_ios.h: In constructor &#8216;std::basic_ios<_CharT, _Traits>::basic_ios() [with _CharT = char, _Traits = std::char_traits<char>]&#8217;:
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/basic_ios.h:447: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/ostream: In constructor &#8216;std::basic_ostream<_CharT, _Traits>::basic_ostream() [with _CharT = char, _Traits = std::char_traits<char>]&#8217;:
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/ostream:341: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/ostream:341: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/ostream:341: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/ostream:341: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/ostream:341: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/ostream: In destructor &#8216;std::basic_ostream<_CharT, _Traits>::~basic_ostream() [with _CharT = char, _Traits = std::char_traits<char>]&#8217;:
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/ostream:113: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/ostream:113: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/ostream:113: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/streambuf_iterator.h: In constructor &#8216;std::istreambuf_iterator<_CharT, _Traits>::istreambuf_iterator(std::basic_streambuf<_CharT, _Traits>*) [with _CharT = char, _Traits = std::char_traits<char>]&#8217;:
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/streambuf_iterator.h:87: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/streambuf_iterator.h: In constructor &#8216;std::istreambuf_iterator<_CharT, _Traits>::istreambuf_iterator() [with _CharT = char, _Traits = std::char_traits<char>]&#8217;:
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/streambuf_iterator.h:79: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/fstream: In destructor &#8216;std::basic_ofstream<_CharT, _Traits>::~basic_ofstream() [with _CharT = char, _Traits = std::char_traits<char>]&#8217;:
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/fstream:586: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/fstream:586: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/fstream:586: warning: will never be executed
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/fstream:586: warning: will never be executed
/tmp/ccqvH2F0.o: In function `main':
main.cpp.text+0x8f): warning: the use of `tmpnam' is dangerous, better use `mkstemp'



--- End Message ---
--- Begin Message ---
Version: 4.6.2-9

not seen, at least with g++ 4.6.2


--- End Message ---

Reply to: