This is the mail archive of the
libstdc++@sources.redhat.com
mailing list for the libstdc++ project.
Re: `cout << setw(...) << "..."' gives segfault
- To: Petter Urkedal <petter dot urkedal at matfys dot lth dot se>
- Subject: Re: `cout << setw(...) << "..."' gives segfault
- From: Rich Churcher <churcher at ihug dot com dot au>
- Date: 17 Oct 2000 14:21:49 +1100
- Cc: libstdc++ at sources dot redhat dot com
- References: <20001016174110.A3631@katsumoto>
Petter Urkedal <petter.urkedal@matfys.lth.se> writes:
> The current CVS gcc/libstdc++-v3 gives segmentation fault when a setw()
> is applied to a C string. Can you reproduce this? Is it a code
> generation thing? -- GDB seems really confused at stackframe #4, and
> the relevant part of the v3 source seems fine to me (dosn't mean it is).
Yes, I noticed this too. Note that (on this box at least):
#include <iostream>
#include <iomanip>
int main() { std::cout << std::setw( 12 ) << 'a'; }
works as expected,
std::cout << std::setw( 13 ) << 'a';
outputs garbage, and
std::cout << std::setw( 14 ) << 'a';
segfaults.
$ g++ -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.97/specs
Configured with: --enable-libstdcxx-v3 --enable-languages=c,c++
gcc version 2.97 20001011 (experimental)
Kernel version is 2.2.16-22.
> [---]$ uname -a
> Linux nilsson 2.2.16 #1 Wed Aug 2 20:03:33 GMT 2000 i686 unknown
Could this be specific to RedHat 7.0? I've never noticed this issue
before, and only upgraded in the past few days.
--
Cheers,
Rich.