public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14651] New: Segfault while using stringstream
@ 2004-03-19 14:57 dvandenbroeck at free dot fr
  2004-03-19 15:04 ` [Bug c++/14651] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dvandenbroeck at free dot fr @ 2004-03-19 14:57 UTC (permalink / raw)
  To: gcc-bugs

Hello everyone ...

- Here is the bug: Using a stringstream on a Sparc Solaris 2 makes
  the program crash with a Segmentation Fault. 

  However, the problem seems to occur only with g++ 3.x or the libstdc++.5.x.
  This works well with gcc 2.95.3 and/or libstdc++.so.2.10.0, and on a PC host
  running GNU/Linux-gcc3.2-libstdc++.so.5 .

- Here is the piece of code:

testnul.cpp:
#include <iostream>
#include <sstream>

using namespace std;

int main (void)
{
  string        s;
  stringstream  t;

  t << "Hello";
  t >> s;

  cout << s << endl;

  return 0;
}

- Let's try:

$ uname -a
SunOS myname 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-4
$ g++ --version
g++ (GCC) 3.1
$ g++ testnul.cpp -o testnul
$ ldd testnul
libstdc++.so.5 => /usr/local/lib/libstdc++.so.5
libm.so.1      => /usr/lib/libm.so.1
libgcc_s.so.1  => /usr/local/lib/libgcc_s.so.1
libc.so.1      => /usr/lib/libc.so.1
libdl.so.1     => /usr/lib/libdl.so.1
/usr/platform/SUNW,Ultra-4/lib/libc_psr.so.1
$ ./testnul
Segmentation Fault

- I also get a segfault if I disable the string insertion:

testnul.cpp:
#include <iostream>
#include <sstream>

using namespace std;

int main (void)
{
  string        s;
  stringstream  t;

  t << "Hello";
//  t >> s;

  cout << "That's all folks" << endl;

  return 0;
}

$ g++ testnul.cpp -o testnul
$ ./testnul
That's all folks
Segmentation Fault

- This time, the object seems to crash at destruction time.
- Finally, the program stops crashing if I also comment the string
  declaration. However, it won't crash neither if I don't use a stringstream
  at all and fill the string with "cin >> s".

- I thought it could comes from this bug:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6784 , so I recompiled the libstdc++
from the latest GCC release (3.3.3) and built the libstdc++.so.5.0.5, but it
didn't help. I couldn't rebuild the whole compiler because of a slight lack of
space to perform a complete GCC bootstrap.

Thanks you in advance !

-- 
           Summary: Segfault while using stringstream
           Product: gcc
           Version: 3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dvandenbroeck at free dot fr
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: sparc-solaris2
  GCC host triplet: sparc-solaris2
GCC target triplet: sparc-solaris2


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


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

* [Bug c++/14651] Segfault while using stringstream
  2004-03-19 14:57 [Bug c++/14651] New: Segfault while using stringstream dvandenbroeck at free dot fr
@ 2004-03-19 15:04 ` pinskia at gcc dot gnu dot org
  2004-03-19 15:09 ` dvandenbroeck at free dot fr
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-19 15:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-19 15:04 -------
Well you first most likely a newer libstdc++ will not work with the older compiler as it sometimes 
depends on compiler features and bug fixes which did not make it into the older compiler.  Can just try 
to download the latested binaries from somewhere for an example sunfreeware has binaries for solaris, 
see <http://www.sunfreeware.com/>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug c++/14651] Segfault while using stringstream
  2004-03-19 14:57 [Bug c++/14651] New: Segfault while using stringstream dvandenbroeck at free dot fr
  2004-03-19 15:04 ` [Bug c++/14651] " pinskia at gcc dot gnu dot org
@ 2004-03-19 15:09 ` dvandenbroeck at free dot fr
  2004-03-19 15:13 ` ebotcazou at gcc dot gnu dot org
  2004-07-13 16:47 ` reichelt at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: dvandenbroeck at free dot fr @ 2004-03-19 15:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dvandenbroeck at free dot fr  2004-03-19 15:09 -------
As required by the guidelines, here is the temp files as an attachment.

-- 


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


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

* [Bug c++/14651] Segfault while using stringstream
  2004-03-19 14:57 [Bug c++/14651] New: Segfault while using stringstream dvandenbroeck at free dot fr
  2004-03-19 15:04 ` [Bug c++/14651] " pinskia at gcc dot gnu dot org
  2004-03-19 15:09 ` dvandenbroeck at free dot fr
@ 2004-03-19 15:13 ` ebotcazou at gcc dot gnu dot org
  2004-07-13 16:47 ` reichelt at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2004-03-19 15:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2004-03-19 15:13 -------
Fixed in GCC 3.2.2 and later.  Since the 3.1.x/3.2.x branch is not maintained
anymore, I close the bug.

I'd recommend GCC 3.2.3 or GCC 3.3.2 as stable compilers on SPARC/Solaris.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug c++/14651] Segfault while using stringstream
  2004-03-19 14:57 [Bug c++/14651] New: Segfault while using stringstream dvandenbroeck at free dot fr
                   ` (2 preceding siblings ...)
  2004-03-19 15:13 ` ebotcazou at gcc dot gnu dot org
@ 2004-07-13 16:47 ` reichelt at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-07-13 16:47 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |3.1.x/3.2.x


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


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

end of thread, other threads:[~2004-07-13 16:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-19 14:57 [Bug c++/14651] New: Segfault while using stringstream dvandenbroeck at free dot fr
2004-03-19 15:04 ` [Bug c++/14651] " pinskia at gcc dot gnu dot org
2004-03-19 15:09 ` dvandenbroeck at free dot fr
2004-03-19 15:13 ` ebotcazou at gcc dot gnu dot org
2004-07-13 16:47 ` reichelt 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).