This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Handle flexible arrays in builtin-object-size


On Thu, May 19, 2011 at 3:44 AM, Richard Guenther <rguenther@suse.de> wrote:
>
> This patch makes us deal with flexible array members and global
> initializers correctly, thus for
>
> struct s {
> ? ?int i;
> ? ?char c[];
> } s = { 1, "01234" };
>
> return 6 for the size of s.c instead of 0 (which is wrong, it
> should have been reported as -1 instead - I didn't try to fix
> that particular issue).
>
> For the total size of the pointed-to object we can simply
> use DECL_SIZE_UNIT instead of TYPE_SIZE_UNIT if it is a decl.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk,
> queued for 4.6 (it's a wrong-code bug, but not a regression).
>
> Richard.
>
> 2011-05-19 ?Richard Guenther ?<rguenther@suse.de>
>
> ? ? ? ?PR middle-end/48985
> ? ? ? ?* tree-object-size.c (addr_object_size): If the pointed-to
> ? ? ? ?variable is a decl use DECL_SIZE_UNIT instead of TYPE_SIZE_UNIT.
>
> ? ? ? ?* gcc.dg/builtin-object-size-11.c: New testcase.
>

Testcase failed on Linux/x86:

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


-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]