From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19788 invoked by alias); 2 Dec 2006 07:29:02 -0000 Received: (qmail 19736 invoked by uid 48); 2 Dec 2006 07:28:50 -0000 Date: Sat, 02 Dec 2006 07:29:00 -0000 Subject: [Bug libstdc++/30047] New: Corrupt return value in specific context X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "spam at david dot osborn dot name" 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: 2006-12/txt/msg00165.txt.bz2 The following code prints an incorrect return value from F. #include #include int F() { std::vector buffer; // this can be any container std::cout << std::endl; return 12345; std::cout << std::endl; } int main() { std::cout << F() << std::endl; // prints something other than 12345 } If any of the lines in F are rearranged, the bug goes away. I did a fresh rebuild of GCC 4.1.1 under MinGW and bug remained. Before the rebuild, the return value was somewhat random, as if it were accessing invalid memory. Since the rebuild, the return value has been a steady 0. Compiled with: $ g++ -oprog prog.cpp && prog -- Summary: Corrupt return value in specific context Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: spam at david dot osborn dot name GCC build triplet: i686-pc-mingw32 GCC host triplet: i686-pc-mingw32 GCC target triplet: i686-pc-mingw32 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30047