The following reply was made to PR libstdc++/7942; it has been noted by GNATS. From: Bill Clarke To: bkoz@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org, paolo@gcc.gnu.org Cc: Subject: Re: libstdc++/7942: ostream core dump with hex/internal/showbase formatted output Date: 11 Nov 2002 16:47:36 +1100 On Wed, 2002-11-06 at 14:33, bkoz@gcc.gnu.org wrote: > Can you try this with gcc or gcc-3_2-branch on solaris? I can't reproduce this on linux either. i can confirm this on a recent checkout of gcc-3_2-branch (20021110) on solaris 2.9, configured with --with-cpu=ultrasparc (also has the same effect with same branch but configured without the cpu flag). gdb stack trace is included in the output shown below (gdb 4.17, yes that's old but a build of gdb 5.2.1 dumps core when doing the stack trace; *sigh* another bug report to do )-: note: i've changed the test code: changed line 16 from "cout << 1" to "cout << 9"; this makes it clearer that the program is reusing buffers (since the string "0x 9" appears in the stack trace, despite the core dump occuring during execution of the following "cout << 0"). also note: the stack trace gets lost after level 6. $ ~/incoming/gcc-cvs/install/bin/g++ -static -g -o iosbug iosbug.cc [static so when i run it i'm sure to get the right library] Current directory is /space/bill/work/tests/ GNU gdb 4.17 Copyright 1998 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 Starting program: /space/bill/work/tests/iosbug 0x9 Program received signal SIGSEGV, Segmentation fault. 0x43da4 in memcpy () at /space/bill/incoming/gcc-cvs/gcc-obj/sparc-sun-solaris2.9/libstdc++-v3/include/sparc-sun-solaris2.9/bits/atomicity.h:89 (gdb) bt #0 0x43da4 in memcpy () at /space/bill/incoming/gcc-cvs/gcc-obj/sparc-sun-solaris2.9/libstdc++-v3/include/sparc-sun-solaris2.9/bits/atomicity.h:89 #1 0x5db74 in _ZNSt5__padIcSt11char_traitsIcEE6_S_padERSt8ios_basecPcPKciib ( __io=@0x1, __fill=58 ':', __news=0xffbff2ba " 9", __olds=0xffbff338 "\210ÿ¿óPÿ¿õ`", __newlen=2, __oldlen=, __num=) at /space/bill/incoming/gcc-cvs/gcc-obj/sparc-sun-solaris2.9/libstdc++-v3/include/bits/char_traits.h:147 #2 0x584f4 in _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertES3_RSt8ios_basecPKci (this=, __s={> = {}, _M_sbuf = 0x60000000, _M_failed = false}, __io=@0x989e0, __fill=32 ' ', __ws=0xffbff2b8 "0x 9", __len=2) at /space/bill/incoming/gcc-cvs/gcc-obj/sparc-sun-solaris2.9/libstdc++-v3/include/bits/locale_facets.tcc:843 #3 0x5838c in _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE12_M_widen_intES3_RSt8ios_basecPci (this=, __s={> = {}, _M_sbuf = 0xa000978, _M_failed = 84}, __io=@0x989e0, __fill=32 ' ', __cs=0xffbff330 "", __len=1) at /space/bill/incoming/gcc-cvs/gcc-obj/sparc-sun-solaris2.9/libstdc++-v3/include/bits/locale_facets.tcc:825 #4 0x58cec in _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE14_M_convert_intImEES3_S3_RSt8ios_basecccT_ (this=, __s={> = {}, _M_sbuf = 0x987, _M_failed = 8}, __io=@0x989e0, __fill=32 ' ', __mod=117 'u', __modl=0 '\000', __v=1140853129) at /space/bill/incoming/gcc-cvs/gcc-obj/sparc-sun-solaris2.9/libstdc++-v3/include/bits/locale_facets.tcc:716 #5 0x58968 in _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE6do_putES3_RSt8ios_basecm (this=, __s={> = {}, _M_sbuf = 0xffbff5, _M_failed = 248}, __io=@0x989e0, __fill=32 ' ', __v=0) at /space/bill/incoming/gcc-cvs/gcc-obj/sparc-sun-solaris2.9/libstdc++-v3/include/bits/locale_facets.tcc:895 #6 0x60fd8 in _ZNSolsEm (this=, __n=0) at /space/bill/incoming/gcc-cvs/gcc-obj/sparc-sun-solaris2.9/libstdc++-v3/include/bits/locale_facets.h:745 Cannot access memory at address 0x5cffc02e. (gdb) cheers, /lib -- /lib: Bill Clarke ResearchScientist CAPResearch DeptCompSci ANU .au http://llib.cjb.net llib@computer.org tel:+61-2-6125x5687 fax:x0010 PGPid:B381EE7DB7D3E58F17248C672E2DA124ADADF444 GNU unix LaTeX XPilot Buffy DrWho Goodies StarTrek XFiles Origami SML SMP MPI mozilla tcsh Asimov Bear Clarke Donaldson Volleyball Ultimate Cricket emacs C++ X Jordan Kay Lackey Martin Stasheff DeepPurple H&C KLF Queen PinkFloyd