This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11376] [3.3/3.4 regression] mozilla-1.4 miscompiled
- From: "kevin dot hendricks at sympatico dot ca" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Jul 2003 02:33:08 -0000
- Subject: [Bug c++/11376] [3.3/3.4 regression] mozilla-1.4 miscompiled
- References: <20030630081619.11376.sirl@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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]$