public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gccbug at oxyware dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/42673]  New: GLIBCXX_DEBUG off-by-one error for std::string operator[]
Date: Sat, 09 Jan 2010 16:55:00 -0000	[thread overview]
Message-ID: <bug-42673-18651@http.gcc.gnu.org/bugzilla/> (raw)

#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


             reply	other threads:[~2010-01-09 16:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-09 16:55 gccbug at oxyware dot com [this message]
2010-01-09 19:15 ` [Bug libstdc++/42673] " paolo dot carlini at oracle dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-42673-18651@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).