This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[egcs-1.0 i386-redhat-linux] C++: bug in setw() for doubles
- To: egcs-bugs at cygnus dot com
- Subject: [egcs-1.0 i386-redhat-linux] C++: bug in setw() for doubles
- From: Ard Kuijpers <ard at wfw dot wtb dot tue dot nl>
- Date: Fri, 5 Dec 1997 20:51:33 +0100
Hello all,
I've succesfully build egcs-1.0 on my pentium RedHat-5.0
system. However when trying to use the egcs compiler for my project I
think I've discovered a bug which I narrowed down to the following
piece of code:
---code---
% cat iomanip_bug.cc
#include <iostream.h>
#include <iomanip.h>
int main()
{
cout << setfill('.');
cout << "int is correct: '..3' == '" << setw(3) << int(3) << "'\n";
cout << "double is wrong: '..3' != '" << setw(3) << double(3) << "'\n";
return 0;
}
---execution---
% ./iomanip_bug > bug.out
% cat bug.out
int is correct: '..3' == '..3'
double is wrong: '..3' != ' 3'
When I look in the file bug.out I see that the spaces in the output
above of double(3) actually aren't spaces but '^@' characters. I saw
the same results with the egcs-971114 and egcs-971201 snapshots on the
same machine. I tried the same code with egcs for mips-sgi-irix5.3 and
the problems did not occur, so I think the problem is linux or x86
specific.
Some more information:
---my system and egcs setup---
RedHat-5.0: i586-pc-linux-gnu
binutils-2.8.1.0.15
% cat $EGCS_TREE/config.status
./configure --host=i386-redhat-linux --enable-haifa--enable-threads=posix \
--prefix=/usr --gxx-include-dir=/usr/include/g++ \
--enable-shared --norecursion
# using "config/mh-x86pic" and "config/mt-x86pic"
Regards,
Ard
****************************************************************************
Ard Kuijpers
Faculty of Mechanical Engineering e-mail:ard@wfw.wtb.tue.nl
Eindhoven University of Technology phone: +31 40 2472811
P.O. Box 513, 5600 MB Eindhoven, The Netherlands fax: +31 40 2461418
****************************************************************************
"...Do what makes your heart hurt less..." _follow_your_heart_ THE PALADINS
****************************************************************************