SIGSEGV in istringstream::str()
-------------------------------

                 Key: STDCXX-427
                 URL: https://issues.apache.org/jira/browse/STDCXX-427
             Project: C++ Standard Library
          Issue Type: Bug
          Components: 27. Input/Output
    Affects Versions: 4.2
         Environment: gcc-3.3.3 on Linux
            Reporter: Martin Sebor
            Priority: Critical


This only happens on trunk, not with 4.1.3:

$ rm t.o && cat t.cpp && make t && gdb -q t
#include <cassert>
#include <sstream>
#include <string>

int main ()
{
    using namespace std;

    string str ("test");
    
    istringstream isstr;
    
    isstr.str (str);

    assert (isstr.str ().length () == str.length ());

    assert (isstr.str () == str);
}
gcc -c -I/amd/devco/sebor/stdcxx/include/ansi -D_RWSTDDEBUG   -pthread 
-I/amd/devco/sebor/stdcxx/include 
-I/build/sebor/stdcxx-gcc-3.3.3_43.41-15s/include 
-I/amd/devco/sebor/stdcxx/examples/include  -pedantic -nostdinc++ -g  -m32 -W 
-Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align 
  t.cpp
gcc t.o -o t -pthread -m32 -L/build/sebor/stdcxx-gcc-3.3.3_43.41-15s/lib  
-lstd15s -lsupc++ -lm 
Using host libthread_db library "/lib64/tls/libthread_db.so.1".
(gdb) r
Starting program: /build/sebor/stdcxx-gcc-3.3.3_43.41-15s/examples/t 
[Thread debugging using libthread_db enabled]
[New Thread 1433271616 (LWP 12696)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1433271616 (LWP 12696)]
0x0804eb4c in __rw::__rw_memcpy (dst=0x556e1014, src=0x80900a0, 
    nbytes=134672708) at /amd/devco/sebor/stdcxx/src/string.cpp:42
42              *tmp++ = *csrc++;
(gdb) where
#0  0x0804eb4c in __rw::__rw_memcpy (dst=0x556e1014, src=0x80900a0, 
    nbytes=134672708) at /amd/devco/sebor/stdcxx/src/string.cpp:42
#1  0x08053781 in std::char_traits<char>::copy (__dst=0x556e1014 "test", 
    __src=0x80900a0 "test", __n=134807716) at _traits.h:425
#2  0x080562ec in basic_string (this=0xffffd0d0, __s=0x80900a0 "test", 
    __n=134807716, [EMAIL PROTECTED]) at string.cc:185
#3  0x0805dac5 in std::basic_stringbuf<char, std::char_traits<char>, 
std::allocator<char> >::str (this=0xffffd048) at sstream:130
#4  0x08049bc9 in std::basic_istringstream<char, std::char_traits<char>, 
std::allocator<char> >::str (this=0xffffd040) at sstream:268
#5  0x0804994d in main () at t.cpp:15


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to