On Thu, May 19, 2011 at 3:44 AM, Richard Guenther <rguent...@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  <rguent...@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.

Reply via email to