[Bug middle-end/28865] Structures with a flexible arrray member have wrong .size
nickc at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jan 13 17:47:00 GMT 2014
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.
More information about the Gcc-bugs
mailing list