[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#232083: libstdc++5: strange behaviour of ios::ate



Package: libstdc++5
Version: 1:3.3.2-4
Severity: normal

I am not sure this is a bug, nor that it pertains to this package, but
anyway, here it is:

//
//  compile with
//
//  g++ -W -Wall -ansi -O -D_REENTRANT -fPIC -fpic -D_FILE_OFFSET_BITS=64
//
#include <fstream>

using namespace std;

int main()
{
    {
	ofstream f("test1.out", ios::out | ios::trunc);
	f << "HI ";
    }
    {
	ofstream f("test1.out", ios::out | ios::ate);
	f << "ALL\n";
    }
    {
	ofstream f("test2.out", ios::out | ios::trunc);
	f << "HI ";
    }
    {
	ofstream f("test2.out", ios::out | ios::app);
	f << "ALL\n";
    }
}


The above piece of code, when compiled with g++-2.95, generates two
identical files test1.out and test2.out.  When compiled with g++-3.3
(and linked against libstdc++5) the generated files differ.

>From $DOC/libstdc++5-3.3-doc/libstdc++/html_user/ios__base_8h-source.html
I think the output files should be identical.

Best regards
G.B.



-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux bohr 2.4.24-1-686 #1 Tue Jan 6 21:29:44 EST 2004 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages libstdc++5 depends on:
ii  gcc-3.3-base                1:3.3.2-4    The GNU Compiler Collection (base 
ii  libc6                       2.3.2.ds1-11 GNU C Library: Shared libraries an
ii  libgcc1                     1:3.3.2-4    GCC support library

-- no debconf information




Reply to: