From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8 Description of problem: The STL filestreams (std::[io]fstream) supplied with the libstdc++ 3.2.3 rpm on RedHat Enterprise Linux 3 seem to lack support for opening files that are bigger than 2 GB. The following test program deomonstrates this issue. It opens a 2500MB file, once using std::ifstream::open() and another time using the C library open() system call. #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <iostream> #include <fstream> int main() { std::ifstream test( "2500MB.bin" ); if( !test.is_open() ) std::cout << "Open via ifstream::open() failed!" << std::endl; if( ::open( "2500MB.bin", O_RDONLY ) == -1 ) std::cout << "Open via C open() failed!" << std::endl; return 0; } Version-Release number of selected component (if applicable): libstdc++-3.2.3-24 How reproducible: Always Steps to Reproduce: 1. Compile test program: g++ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE test.cpp 2. Create a file > 2GB: dd if=/dev/zero of=2500MB.bin bs=1M count=2500 on an ext3 partition 3. Call the testprogram in the directory the file was created: ./a.out Actual Results: std::ifstream::open() fails, C lib open() succeeds. Expected Results: Both open() calls succeed. Additional info: Curiously, when using std::ifstream::open() on the 2500MB file on a reiserfs partition it succeeds. I don't know if this is a Bug or a feature of that filesystem. Note that the C open() also succeeds when adding the O_LARGEFILE flag and compiling the test program without the defines.
Internal RFE bug #117336 entered.
This will be fixed in RHEL4. It is not suitable for RHEL3, as it needs to maintain libstdc++ ABI compatibility.