[Bug c++/52337] New: memory hole

xiaoyuanbo at yeah dot net gcc-bugzilla@gcc.gnu.org
Wed Feb 22 08:04:00 GMT 2012


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

             Bug #: 52337
           Summary: memory hole
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: xiaoyuanbo@yeah.net


#include<iostream>
#include<stdio.h>
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;
printf("%p\n%p   %lx\n%p   %lx\noriginal pointer is:",i,a,h2-h1,b,h3-h2);
std::cout<<&i<<std::endl;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;
printf("%p\n%p   %lx\n%p   %lx\noriginal pointer is:",i,a,h2-h1,b,h3-h2);
std::cout<<&i<<std::endl;return 0;}
main(){m[3]=(pgabstract*)&ai;m[3]->get();}

in the code i sure port in a class abstract
like class a{int i;virtual void t()=0;}; i sure i is circle and class typedef a
is not a inheritance.in code anywhere i donnt invite the value of class a
ai.assert
but i assert faile compile donnt alert me to memory hole i sure through out.
i alarm the name of class a privilage memory hole. it is concept. alert must!



More information about the Gcc-bugs mailing list