This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52337] memory hole
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 22 Feb 2012 09:35:44 +0000
- Subject: [Bug c++/52337] memory hole
- Auto-submitted: auto-generated
- References: <bug-52337-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52337
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-22 09:35:44 UTC ---
(do you have something against whitespace?!)
could you explain exactly what you think GCC does wrong, and what you expect to
happen?
I'm afraid I don't understand your report.
Here's the same code, once more with formatting:
typedef char**(*(*v[4])(int*p[],float (*f)(int a[])))[][6];
class e{ v i,a,b;
public:
int get();
friend int g();
} ai;
int e::get() {
long h1,h2,h3;
h1=(long)&i;
h2=(long)&a;
h3=(long)&b;
__builtin_printf("%p\n%p %lx\n%p %lx\noriginal pointer is:
%p\n",i,a,h2-h1,b,h3-h2, &i);
return 0;
}
int g(){ return ai.get(); }
class pgabstract{
v i,a,b;
public:
int get() {return vget();}
int(*p)();
virtual void t()=0;
int vget();
} *m[4];
int pgabstract::vget()
{
long h1,h2,h3;
h1=(long)&i;
h2=(long)&a;
h3=(long)&b;
__builtin_printf("%p\n%p %lx\n%p %lx\noriginal pointer is:
%p\n",i,a,h2-h1,b,h3-h2, &i);
return 0;
}
int main(){
m[3]=(pgabstract*)&ai;
m[3]->get();
}
When I run this I get:
0x600b48
0x600b68 20
0x600b88 20
original pointer is: 0x600b48