This is the mail archive of the libstdc++@sources.redhat.com 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: `cout << setw(...) << "..."' gives segfault


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.  

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