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++/7942: ostream core dump with hex/internal/showbase formatted output


>Number:         7942
>Category:       libstdc++
>Synopsis:       ostream core dump with hex/internal/showbase formatted output
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 16 20:46:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Bill Clarke
>Release:        3.1.1
>Organization:
Australian National University
>Environment:
System: SunOS bullet 5.8 Generic_108528-15 sun4u sparc SUNW,Ultra-5_10
Architecture: sun4

both 32 and 64-bit targets fail
host: sparc-sun-solaris2.8
build: sparc-sun-solaris2.8
target: sparc-sun-solaris2.8
configured with: ../gcc-3.1.1/configure --with-cpu=ultrasparc --enable-lanaguages=c,c++,f77 : (reconfigured) ../gcc-3.1.1/configure --with-cpu=ultrasparc --enable-languages=c,c++,f77
>Description:
a program that uses a particular combination of formatted output (ostream)
dumps core.

>How-To-Repeat:
// iosbug.cc:
#include <iostream>
#include <iomanip>

int main() {
  using namespace std;

  cout.flags(ios_base::showbase);
  cout << internal;
  cout << hex;

  cout << setw(2);		// must be >1 for bug! (5 also dumps)
  //  cout << 0;		// can print out a number (doesn't change bug)
  cout << endl;			// must be endl for bug, !flush!

  cout << 1;			// must be non-zero for bug!
  cout << endl;			// must be endl for bug, !flush!

  cout << setw(2);		// must be >1 for bug! (5 also dumps)
  cout << 0;			// dumps core in std::__put
  cout << endl;

  return 0;
}
// end of iosbug.cc

$ g++ -Wall -m32 -g iosbug.cc -o iosbug
$ ./iosbug

0x1
Segmentation fault (core dumped)
Exit 139
$ 

according to dbx:
$ dbx iosbug core
Reading iosbug
core file header read successfully
Reading ld.so.1
Reading libstdc++.so.4
Reading libm.so.1
Reading libgcc_s.so.1
Reading libc.so.1
Reading libdl.so.1
Reading libc_psr.so.1
program terminated by signal SEGV (no mapping at the fault address)
0xff3206cc: __align_cpy_1+0x00dc:       ldd     [%g1], %f0
dbx: warning: invalid frame pointer
(/usr/local/SUNWspro/bin/../WS6U2/bin/sparcv9/dbx) where
=>[1] __align_cpy_1(0xffbeff80, 0xffbeffff, 0xfffff21a, 0x7, 0xfffff210, 0xffbef19b), at 0xff3206cc
  [2] _ZSt5__padIcSt11char_traitsIcEEvRSt8ios_baseT_PS4_PKS4_iib(0x2b, 0xffbef21a, 0xffbef19a, 0xffbef218, 0x2, 0x1), at 0xff2c98a8
  [3] _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertES3_RSt8ios_basecPKci(0xff3091a8, 0xffbef220, 0x21628, 0x20, 0xffbef198, 0x2), at 0xff2c3cac
(/usr/local/SUNWspro/bin/../WS6U2/bin/sparcv9/dbx) exit
$ 

64-bit build of iosbug does similar.

(if you really want preprocessor output for the above source, then email me!)
>Fix:
workaround: none known.

i'm guessing it's a bug somewhere in std::__pad; when installed:
${prefix}/include/c++/3.1.1/bits/locale_facets.tcc, in source:
gcc/libstdc++-v3/include/bits/locale_facets.tcc.  i note from cvsweb that
__pad has changed recently (1.77->1.78) but i don't know if that will
affect the bug.
>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]