This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


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

Re: gcc-ss-20010521 is now available


On Tue, May 22, 2001 at 12:26:49AM -0000, law@sourceware.cygnus.com wrote:
> gcc-ss-20010521 is now available on 
> ftp://gcc.gnu.org/pub/gcc/snapshots/2001-05-21

Something is seriously wrong with this version.
When I configure it such that libstdc++ gets compiled with
-O9 -march=pentiumpro -fomit-frame-pointer
then the simplest program that includes <iostream>
crashes in _init (on a jmp).

>cat test.cc
#include <iostream>
int main() {
  return 0;
}
>g++-3.0 -g test.cc
>a.out
Segmentation fault (core dumped)

gdb gives:

Core was generated by `a.out'.
Program terminated with signal 11, Segmentation fault.
...
(gdb) bt
#0  0x4004dcf0 in _init () from /usr/local/gcc-3.0/lib/libstdc++.so.3
#1  0x400a2573 in std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*) (this=0x0,
    __sb=0x0) at /usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/include/bits/basic_ios.tcc:121

A disassemble shows:

0x4004dceb <_init+2803>:        jmp    0x4004d210 <_init+24>
0x4004dcf0 <_init+2808>:        jmp    *0x2c0(%ebx)

(gdb) p/x $ebx
$2 = 0xc00f57c7
(gdb) p *((void**)0xc00f57c7)
Cannot access memory at address 0xc00f57c7

(gdb) watch $ebx
(gdb) cond 2 $ebx == 0xc00f57c7
(gdb) r
Old value = -1073744872
New value = -1072736313
0x40052483 in std::ios_base::_M_init() (this=0x40149228) at /usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/src/ios.cc:241
241       {
(gdb) l
236       }
237
238       // Called only by basic_ios<>::init.
239       void
240       ios_base::_M_init()
241       {
242         // NB: May be called more than once
243         _M_precision = 6;
244         _M_width = 0;
245         _M_flags = skipws | dec;

Dump of assembler code for function _ZNSt8ios_base7_M_initEv:
0x40052470 <_ZNSt8ios_base7_M_initEv>:  push   %ebp
0x40052471 <_ZNSt8ios_base7_M_initEv+1>:        mov    %esp,%ebp
0x40052473 <_ZNSt8ios_base7_M_initEv+3>:        push   %esi
0x40052474 <_ZNSt8ios_base7_M_initEv+4>:        push   %ebx
0x40052475 <_ZNSt8ios_base7_M_initEv+5>:        sub    $0x10,%esp
0x40052478 <_ZNSt8ios_base7_M_initEv+8>:        call   0x4004e560 <init_dummy+32>
0x4005247d <_ZNSt8ios_base7_M_initEv+13>:       add    $0xf63af,%ebx			<-- Assignment of incorrect value to %ebx
0x40052483 <_ZNSt8ios_base7_M_initEv+19>:       mov    0x8(%ebp),%esi
0x40052486 <_ZNSt8ios_base7_M_initEv+22>:       movl   $0x6,(%esi)
0x4005248c <_ZNSt8ios_base7_M_initEv+28>:       movl   $0x0,0x4(%esi)
0x40052493 <_ZNSt8ios_base7_M_initEv+35>:       sub    $0x8,%esp
0x40052496 <_ZNSt8ios_base7_M_initEv+38>:       push   $0x2
0x40052498 <_ZNSt8ios_base7_M_initEv+40>:       push   $0x1000
0x4005249d <_ZNSt8ios_base7_M_initEv+45>:       call   0x4004dcf0 <_init+2808>		<-- Call to address where it cores.

(gdb) p/x -1073744872
$3 = 0xbffff418
(gdb) p/x -1072736313
$4 = 0xc00f57c7
(gdb) p/x 0xc00f57c7 - 0xbffff418
$5 = 0xf63af

(gdb) si
243         _M_precision = 6;
(gdb)
244         _M_width = 0;
(gdb)
245         _M_flags = skipws | dec;
(gdb)
0x40052496      245         _M_flags = skipws | dec;
(gdb)
0x40052498      245         _M_flags = skipws | dec;
(gdb)
0x4005249d      245         _M_flags = skipws | dec;
(gdb)
0x4004dcf0 in _init () from /usr/local/gcc-3.0/lib/libstdc++.so.3
(gdb)
 
Program received signal SIGSEGV, Segmentation fault.
0x4004dcf0 in _init () from /usr/local/gcc-3.0/lib/libstdc++.so.3

Note that when I compile libstdc++ with -O0 everything works fine.

-- 
Carlo Wood <carlo@alinoe.com>


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