This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/60041] New: Strange behavior


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60041

            Bug ID: 60041
           Summary: Strange behavior
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qroc.work at gmail dot com

Created attachment 32025
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32025&action=edit
binary file

#include <iostream>

using namespace std;

struct Foo
{
    Foo( int i )
    : i_( i )
    {
    }

    int i_;
};

void test1()
{
    Foo *f2;

    cout<<f2->i_<<endl;
}

int main()
{
    Foo f( 123 );
    test1();
    Foo *f3;

    cout<<f3->i_<<endl;

    return 0;
}


$ g++ t.cc && ./a.out
123
-125990072


OS X 10.9
g++ (GCC) 4.9.0 20131020 (experimental)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]