This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/28865] Structures with a flexible arrray member have wrong .size
- From: "nickc at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 13 Jan 2014 17:47:09 +0000
- Subject: [Bug middle-end/28865] Structures with a flexible arrray member have wrong .size
- Auto-submitted: auto-generated
- References: <bug-28865-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28865
Nick Clifton <nickc at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #31802|0 |1
is obsolete| |
--- Comment #23 from Nick Clifton <nickc at gcc dot gnu.org> ---
Created attachment 31823
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31823&action=edit
Revised patch, with testcases
Hi Guys,
I have uploaded a revised patch with two changes:
1. I have removed the assertion from
output_constructor_regular_field() and changed the code so that
extra zeros are emitted only if fieldpos is more than the current
byte total. I made this change because I feel that we should avoid
ICEs even on invalid code.
2. I have added two tests to the testsuite, based on comments 3 and
13.
Still no regressions with an i686-pc-linux-gnu toolchain and an
aarch64-elf toolchain.
OK to apply ?
Cheers
Nick
gcc/ChangeLog
2014-01-13 Nick Clifton <nickc@redhat.com>
PR middle-end/28865
* varasm.c (output_consant): Return the number of bytes actually
emitted.
(output_constructor_array_range): Update the field size with the
number of bytes emitted by output_constant.
(output_constructor_regular_field): Likewise. Also do not
complain if the total number of bytes emitted is now greater
than the expected fieldpos.
* output.h (output_constant): Update prototype and descriptive
comment.
gcc/testsuite/ChangeLog
2014-01-13 Nick Clifton <nickc@redhat.com>
PR middle-end/28865
* gcc.c-torture/compile/pr28865.c: New.
* gcc.c-torture/execute/pr28865.c: New.