From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18153 invoked by alias); 13 Jul 2009 14:23:16 -0000 Received: (qmail 17289 invoked by uid 48); 13 Jul 2009 14:23:02 -0000 Date: Mon, 13 Jul 2009 14:23:00 -0000 Subject: [Bug libstdc++/40732] New: fstream get/put pointers have unexpected positions X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "elizbus at yahoo dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-07/txt/msg01027.txt.bz2 My understanding is that with fstream, get and put pointers move together. Therefore expect output of following to be aabbc1234, output is actually aabbc. This had expected result with 3.3.1, unexpected result with 3.4.4. #include using namespace std; int main(int argc, char* argv[]) { fstream myStream; myStream.open("myTestFile.out", ios_base::in | ios_base::out | ios::trunc); // write "aabbc" to file myStream.put('a'); myStream.put('a'); myStream << "b"; myStream << "b"; myStream << "c"; //rewind myStream.seekg(0); char c; //skip over data for (int i=0; i < 5; i++) { myStream.get(c); } // append 1234 to file myStream << "1234\n"; myStream.close(); return 0; } Configured with: ./configure --prefix=/usr/local/gcc-3.4.4 Thread model: posix gcc version 3.4.4 -- Summary: fstream get/put pointers have unexpected positions Product: gcc Version: 3.4.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: elizbus at yahoo dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40732