public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/42673]  New: GLIBCXX_DEBUG off-by-one error for std::string operator[]
@ 2010-01-09 16:55 gccbug at oxyware dot com
  2010-01-09 19:15 ` [Bug libstdc++/42673] " paolo dot carlini at oracle dot com
  0 siblings, 1 reply; 2+ messages in thread
From: gccbug at oxyware dot com @ 2010-01-09 16:55 UTC (permalink / raw)
  To: gcc-bugs

#include <string>

int main()
{
    std::string s = "foo";
    s[3];       // doesn't throw and should
}

when compiled with g++ -D_GLIBCXX_DEBUG doesn't throw but should.  It does
throw with s[4] and s[-1], however.

test$ g++ -D_GLIBCXX_DEBUG gccbug.cpp && ./a.out

test$ g++ -v
Using built-in specs.
Target: i586-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-ppl --with-cloog --with-tune=generic --with-arch=i586
--build=i586-redhat-linux
Thread model: posix
gcc version 4.4.1 20090725 (Red Hat 4.4.1-2) (GCC) test

$ uname -a
Linux maisy.oxyware.net 2.6.30.10-105.fc11.i686.PAE #1 SMP Thu Dec 24 16:41:17
UTC 2009 i686 i686 i386 GNU/Linux

Fedora Core 11, 32-bit Intel x86, using distro rpm

test$ rpm -q gcc
gcc-4.4.1-2.fc11.i586


-- 
           Summary: GLIBCXX_DEBUG off-by-one error for std::string
                    operator[]
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gccbug at oxyware dot com


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


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

* [Bug libstdc++/42673] GLIBCXX_DEBUG off-by-one error for std::string operator[]
  2010-01-09 16:55 [Bug c++/42673] New: GLIBCXX_DEBUG off-by-one error for std::string operator[] gccbug at oxyware dot com
@ 2010-01-09 19:15 ` paolo dot carlini at oracle dot com
  0 siblings, 0 replies; 2+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-01-09 19:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from paolo dot carlini at oracle dot com  2010-01-09 19:15 -------
This is intended. If you want to enforce that check use _GLIBCXX_DEBUG_PEDANTIC
additionally (the docs describe also the pedantic mode). And... always keep in
mind that this is *free software* and our sources are generally pretty well
commented.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|c++                         |libstdc++
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2010-01-09 19:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-09 16:55 [Bug c++/42673] New: GLIBCXX_DEBUG off-by-one error for std::string operator[] gccbug at oxyware dot com
2010-01-09 19:15 ` [Bug libstdc++/42673] " paolo dot carlini at oracle dot com

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