This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libstdc++/6784: SEGV using istream >> operator under gcc-3.1/sun-sparc-solaris2.6



>Number:         6784
>Category:       libstdc++
>Synopsis:       SEGV using istream >> operator under gcc-3.1/sun-sparc-solaris2.6
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 23 06:26:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Andrew.Pollard@brooks-pri.com
>Release:        3.1
>Organization:
Brooks-PRI Automation
>Environment:
System: SunOS primo 5.6 Generic_105181-26 sun4u sparc SUNW,Ultra-4
Architecture: sun4

host: sparc-sun-solaris2.6
build: sparc-sun-solaris2.6
target: sparc-sun-solaris2.6
configured with: /disks/arlene/gnu/gcc-3.1/configure --prefix=/disks/homes/andrewp/compilers/gcc-3.1-sun-sparc-solaris2.6 --with-gnu-as --with-gnu-ld --enable-threads=solaris --enable-version-specific-runtime-libs --disable-shared --enable-languages=c++

binutils-2.12.1
>Description:
The following simple program:

bug.cxx
-----------------
#include <string>
#include <iostream>

int
main()
{
    std::string tok;
    std::cin >> tok;
    return (0);
}
-----------------

Causes a SEGV when compiled and run with the stock gcc-3.1/sun-sparc-solaris2.6
on a Solaris2.6 machine

This does not occur for

a) gcc-3.1/sun-sparc-solaris2.8
b) gcc-3.1/i686-pc-linux-gnu
c) gcc-3.0.4/sun-sparc-solaris2.6
>How-To-Repeat:
% g++ -v
Reading specs from /disks/homes/andrewp/compilers/gcc-3.1-sun-sparc-solaris2.6/lib/gcc-lib/sparc-sun-solaris2.6/3.1/specs
Configured with: /disks/arlene/gnu/gcc-3.1/configure --prefix=/disks/homes/andrewp/compilers/gcc-3.1-sun-sparc-solaris2.6 --with-gnu-as --with-gnu-ld --enable-threads=solaris --enable-version-specific-runtime-libs --disable-shared --enable-languages=c++
Thread model: solaris
gcc version 3.1

% g++ -g bug.cxx
% ./a.out < bug.cxx
Segmentation fault

% gdb ./a.out
GNU gdb 5.2
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.6"...
(gdb) run < bug.cxx
Starting program: /disks/homes/andrewp/a.out < bug.cxx

Program received signal SIGSEGV, Segmentation fault.
0x0002850c in std::istream::sentry::sentry(std::istream&, bool) (
    this=0xeffffa27, __in=@0x50d40, __noskipws=35)
    at /disks/primo4/workplaces/andrewp/gnu/gcc-3.1-standard-build/sparc-sun-solaris2.6/libstdc++-v3/include/sparc-sun-solaris2.6/bits/ctype_inline.h:40
40        { return _M_table[static_cast<unsigned char>(__c)] & __m; }
(gdb) where
#0  0x0002850c in std::istream::sentry::sentry(std::istream&, bool) (
    this=0xeffffa27, __in=@0x50d40, __noskipws=35)
    at /disks/primo4/workplaces/andrewp/gnu/gcc-3.1-standard-build/sparc-sun-solaris2.6/libstdc++-v3/include/sparc-sun-solaris2.6/bits/ctype_inline.h:40
#1  0x0002cb1c in std::basic_istream<char, std::char_traits<char> >& std::operator>><char, std::char_traits<char>, std::allocator<char> >(std::basic_istream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (__in=@0x50d40, __str=@0xeffffab8)
    at /disks/primo4/workplaces/andrewp/gnu/gcc-3.1-standard-build/sparc-sun-solaris2.6/libstdc++-v3/include/bits/istream.tcc:1133
#2  0x00011224 in main () at bug.cxx:8
(gdb) quit

Whereas on a Solaris2.8 system...

% g++ -v
Reading specs from /disks/homes/andrewp/compilers/gcc-3.1-sun-sparc-solaris2.8/lib/gcc-lib/sparc-sun-solaris2.8/3.1/specs
Configured with: /disks/arlene/gnu/gcc-3.1/configure --prefix=/disks/homes/andrewp/compilers/gcc-3.1-sun-sparc-solaris2.8 --with-gnu-as --with-gnu-ld --enable-threads=solaris --enable-version-specific-runtime-libs --disable-shared --enable-languages=c++
Thread model: solaris
gcc version 3.1

% g++ -g bug.cxx

% ./a.out < bug.cxx
%

>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]