public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/31246]  New: Strange -Wunreachable-code warning with _GLIBCXX_DEBUG
@ 2007-03-17 16:38 sylvain dot pion at sophia dot inria dot fr
  2007-03-17 16:58 ` [Bug libstdc++/31246] " pinskia at gcc dot gnu dot org
                   ` (29 more replies)
  0 siblings, 30 replies; 32+ messages in thread
From: sylvain dot pion at sophia dot inria dot fr @ 2007-03-17 16:38 UTC (permalink / raw)
  To: gcc-bugs

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

Compiling the following with "-Wunreachable-code -D_GLIBCXX_DEBUG"
--------------------------
#include <vector>

int main()
{
  std::vector<int>::iterator a;
}
--------------------------

produces the warning :

--------------------------
/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../include/c++/4.1.1/debug/safe_iterator.h:
In constructor ‘__gnu_debug::_Safe_iterator<_Iterator,
_Sequence>::_Safe_iterator() [with _Iterator =
__gnu_cxx::__normal_iterator<int*, __gnu_norm::vector<int, std::allocator<int>
> >, _Sequence = __gnu_debug_def::vector<int, std::allocator<int> >]’:
/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../include/c++/4.1.1/debug/safe_iterator.h:103:
warning: will never be executed
--------------------------

I tried g++ 4.1, 4.2 and 4.3.  They all produce this annoying warning.

Looking at the code in safe_iterator.h shows nothing obviously wrong.
This might even suggest a bug in -Wunreachable-code, although I categorized
it for now in libstdc++, as I have not been able to isolate a small piece
of code that reproduces the problem.


Some other compilers tend to have the equivalent of -Wunreachable-code
by default.  It would be nice if it worked well, and if it was enabled
by -Wall or -Wextra.


-- 
           Summary: Strange -Wunreachable-code warning with _GLIBCXX_DEBUG
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sylvain dot pion at sophia dot inria dot fr
  GCC host triplet: i686-pc-linux-gnu


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


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

end of thread, other threads:[~2009-07-07 22:20 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-17 16:38 [Bug libstdc++/31246] New: Strange -Wunreachable-code warning with _GLIBCXX_DEBUG sylvain dot pion at sophia dot inria dot fr
2007-03-17 16:58 ` [Bug libstdc++/31246] " pinskia at gcc dot gnu dot org
2007-03-17 17:27 ` sylvain dot pion at sophia dot inria dot fr
2007-03-17 17:46 ` chris at bubblescope dot net
2007-03-17 18:07 ` chris at bubblescope dot net
2007-03-17 20:41 ` pcarlini at suse dot de
2007-03-17 20:48 ` [Bug c++/31246] " pcarlini at suse dot de
2007-03-17 23:35 ` gdr at cs dot tamu dot edu
2007-03-18  5:38 ` pinskia at gcc dot gnu dot org
2007-03-19 13:56 ` manu at gcc dot gnu dot org
2007-03-19 15:19 ` gdr at cs dot tamu dot edu
2007-03-19 22:31 ` pinskia at gcc dot gnu dot org
2007-03-19 22:45   ` Gabriel Dos Reis
2007-03-19 22:45 ` gdr at cs dot tamu dot edu
2007-03-19 23:13 ` manu at gcc dot gnu dot org
2007-03-19 23:19 ` pinskia at gcc dot gnu dot org
2007-03-19 23:35 ` manu at gcc dot gnu dot org
2007-03-19 23:40 ` gdr at cs dot tamu dot edu
2007-03-19 23:43 ` pcarlini at suse dot de
2008-08-23 16:00 ` manu at gcc dot gnu dot org
2008-08-23 16:02 ` manu at gcc dot gnu dot org
2008-08-23 16:14 ` manu at gcc dot gnu dot org
2008-08-23 16:23 ` manu at gcc dot gnu dot org
2008-08-23 17:25 ` manu at gcc dot gnu dot org
2008-08-23 18:44 ` paolo dot carlini at oracle dot com
2008-08-23 18:46 ` [Bug c++/31246] Strange -Wunreachable-code warnings paolo dot carlini at oracle dot com
2008-08-23 18:51 ` [Bug c++/31246] -Wunreachable-code warnings for compiler-generated code manu at gcc dot gnu dot org
2008-08-26  5:46 ` gdr at integrable-solutions dot net
2008-10-22  8:36 ` manu at gcc dot gnu dot org
2009-02-07 21:07 ` manu at gcc dot gnu dot org
2009-07-07 22:19 ` manu at gcc dot gnu dot org
2009-07-07 22:20 ` manu 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).