public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/30047]  New: Corrupt return value in specific context
@ 2006-12-02  7:29 spam at david dot osborn dot name
  2008-06-08 19:56 ` [Bug target/30047] " gcc at david dot osborn dot name
  2008-06-08 20:02 ` gcc at david dot osborn dot name
  0 siblings, 2 replies; 4+ messages in thread
From: spam at david dot osborn dot name @ 2006-12-02  7:29 UTC (permalink / raw)
  To: gcc-bugs

The following code prints an incorrect return value from F.

#include <iostream>
#include <vector>

int F()
{

        std::vector<char> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread
[parent not found: <bug-30047-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2011-04-12 19:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-02  7:29 [Bug libstdc++/30047] New: Corrupt return value in specific context spam at david dot osborn dot name
2008-06-08 19:56 ` [Bug target/30047] " gcc at david dot osborn dot name
2008-06-08 20:02 ` gcc at david dot osborn dot name
     [not found] <bug-30047-4@http.gcc.gnu.org/bugzilla/>
2011-04-12 19:44 ` ktietz at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).