From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2772 invoked by alias); 18 Aug 2004 19:20:30 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 2760 invoked by uid 48); 18 Aug 2004 19:20:29 -0000 Date: Wed, 18 Aug 2004 19:20:00 -0000 From: "scrimr at louisville dot stortek dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20040818192027.17086.scrimr@louisville.stortek.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug libstdc++/17086] New: IOStreams Large File Support (> 2 GB) not fully implemented. X-Bugzilla-Reason: CC X-SW-Source: 2004-08/txt/msg01845.txt.bz2 List-Id: Reading specs from /usr/local/lib/gcc/sparc-sun-solaris2.8/3.4.1/specs Configured with: ../configure --with-as=/usr/ccs/bin/as --with- ld=/usr/ccs/bin/ld --disable-nls Thread model: posix gcc version 3.4.1 Solaris 8 patch level is generic_108528-17 recommended patch cluster I converted this code from c library functions that did work for 64-bit files. Before the 3.4.1 compiler I could not create files >2 GB with this stream code but it was completely working properly for files <= 2 GB(-1). With the same program I can write files larger than 2 GB with the ofstream class (e.g. 5 GB), which I could not do before gcc 3.4.1, but now I am unable to seekg in files of any size with the ifsteam class. I also cannot sequentially read (without seeks) in files larger than 2 GB with the ifstream class (e.g. 5 GB). Code Snippit that fails (throws exception) is as follows: inStream.exceptions( ios::failbit | ios::badbit ); inStream.open( fileToProcess.c_str(), ios::in | ios::binary | ios::ate ); ... int markerLength = (verificationMarker()).size(); // = 5 inStream.seekg( -(rawSumLength()+markerLength),ios::cur); // 5 + 16 ... SumMarkerFromFile = new char[markerLength+1]; SumMarkerFromFile[markerLength] = '\0'; inStream.read( SumMarkerFromFile, markerLength ); The code opens the ifstream for a file in binary mode and at the end of the file. Then I try to back up 21 bytes for some data that I need to read. Then I try to read it and the code then throws an exception on the read. Both seekg and open do not seem to be failing. read is throwing an exception. The problem seems to occurs regardless of file size. I think the seekg call is causing a bad stream state and then the read throws an exception because of the bad stream state. Keep in mind that this does not work even for file less than or equal to 2 GB with the 3.4.1 compiler/libraies. Anyway, seekg may be one of the failing components. The wierd thing is that if I open a file and read it sequentially without seeks for files smaller than 2 GB it works fine. For files above 2 GB, the sequential reading does not work and does not even throw exceptions. It appears to work but I know there is no way that it read a 5 GB file in less than a second. So, it does not appear to be working here either. I think this iostreams LFS support needs to be carefully rechecked for completeness. Also, it seems that iostreams support in general seems to be broken for files below 2 GB now (e.g. seekg). If you have any questions or suggestions I would love to hear them. If you think I am doing something wrong I would love to hear that too. -- Summary: IOStreams Large File Support (> 2 GB) not fully implemented. Product: gcc Version: 3.4.1 Status: UNCONFIRMED Severity: critical Priority: P1 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: scrimr at louisville dot stortek dot com CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: 3.4.1 GCC host triplet: 3.4.1 GCC target triplet: 3.4.1 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17086