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++/11376] [3.3/3.4 regression] mozilla-1.4 miscompiled


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From kevin dot hendricks at sympatico dot ca  2003-07-08 02:33 -------
Subject: Re:  [3.3/3.4 regression] mozilla-1.4 miscompiled

Hi,

Just to add insult to injury here ...  


[kbhend@base1 huh]$ cat tcase6.cxx
struct A {
  virtual int Setit(int k) = 0;
};

struct B : A {
    int Setit(int k) { int i; i = k; }
};

A* a;
void ** begin_assign() { return reinterpret_cast< void **> (&a); }

int
main(int argc, char** argv)
{
    B** ppB = reinterpret_cast<B**> (begin_assign());
    *ppB = new B();
    a->Setit(0);
    return 0;
}

[kbhend@base1 huh]$ g++ -O2 -o tcase6 tcase6.cxx
[kbhend@base1 huh]$ ./tcase6
Segmentation fault

[kbhend@base1 huh]$ g++ -O2 -finline-functions -o tcase6 tcase6.cxx
[kbhend@base1 huh]$ ./tcase6
[kbhend@base1 huh]$ 

[kbhend@base1 huh]$ g++ -O2 -fno-strict-aliasing -o tcase6 tcase6.cxx
[kbhend@base1 huh]$ ./tcase6
[kbhend@base1 huh]$


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