[Bug c/18063] Gcc doesn't check overflowed size of structure

mikulas at artax dot karlin dot mff dot cuni dot cz gcc-bugzilla@gcc.gnu.org
Tue Oct 19 17:32:00 GMT 2004


------- Additional Comments From mikulas at artax dot karlin dot mff dot cuni dot cz  2004-10-19 17:32 -------
Subject: Re:  Gcc doesn't check overflowed size of structure

If you rewrite it to

int main(void)
{
        size_t c = sizeof(struct a);
        struct a *b = malloc(c);
        return sizeof (struct a);
}

, it doesn't give warning with -W -Wall (except for unused b).

BTW. for array too large it gives error, so I think for structure, it
should too.

Mikulas


-- 


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



More information about the Gcc-bugs mailing list