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]

stream bug with "0xBlabla" strings in internal mode


The bug was reproduced with the following g++ :
gcc version 3.1 20010624 (experimental) - cvs
gcc version 3.1 20010707 (experimental) - cvs
gcc version 3.0 20010402 (Debian prerelease)
i686-pc-linux-gnu

and is not present in
gcc version 2.95.4 20010319 (Debian prerelease)

With the faulty compilers, the resulting string looks like :
Trap!ZZZÜø

(the 2 last chars vary, clearly comig from improper memory accesses)

hth,
-- 
Sam
#include <cassert>
#include <iostream>
#include <sstream>

int main(){
  using namespace std;
  stringstream oss;
  oss.setf(std::ostream::internal, std::ostream::adjustfield);
  oss.width(10);
  oss.fill('Z');
  oss << "0xTrap!";
  cout << oss.str() << endl;

  assert( oss.str() == "ZZZ0xTrap!" );

}

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