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:05:02 -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:05 -------
Subject: Re: [3.3/3.4 regression] mozilla-1.4 miscompiled
Hi,
> As a hint for further testcase reduction: make all classes structs, and
> remove the public/private/protected markers. Then try to do some of
> the inlining by hand, by replacing the use of accessor functions by
> direct accesses of the respective values, and subsequent removal of
> the accessor functions.
Okay- following along those lines we now get tcase5.cxx
#include <cstdio>
struct A {
virtual int Setit(int k) = 0;
};
struct B : A {
int i;
int Setit(int k) { i = k; }
};
struct SP {
A * a;
void ** begin_assign();
};
void ** SP::begin_assign() { return reinterpret_cast< void **> (&a); }
int
main(int argc, char** argv)
{
SP p;
B** retval = reinterpret_cast<B**> (p.begin_assign());
*retval = new B();
(p.a)->Setit(0);
fprintf(stderr,"done\n"); fflush(stderr);
return 0;
}
[kbhend@base1 huh]$ g++ -O2 -o tcase5 tcase5.cxx
[kbhend@base1 huh]$ ./tcase5
Segmentation fault
[kbhend@base1 huh]$ g++ -O2 -fno-strict-aliasing -o tcase5 tcase5.cxx
[kbhend@base1 huh]$ ./tcase5
done
[kbhend@base1 huh]$ g++ -O2 -finline-functions -o tcase5 tcase5.cxx
[kbhend@base1 huh]$ ./tcase5
done
Kevin