This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/36987] New: Truncated C struct data initializer with variable size trailing array
- From: "howard dot thomson at dial dot pipex dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Jul 2008 12:35:34 -0000
- Subject: [Bug c/36987] New: Truncated C struct data initializer with variable size trailing array
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
An initializer for a C struct with a variable sized last component is accepted,
but the data generated excludes the variable sized component.
struct s {
int16_t a,b,c,d;
int16_t y[];
} data = {0,0,0,0, {2,3,4,5}};
results in only the leading four int16_t values in the data segment.
Either the initializer data should be emitted, or the initializer should be
rejected with an error, or the struct declaration should be rejected with an
error, and presumably the first option would be preferable.
--
Summary: Truncated C struct data initializer with variable size
trailing array
Product: gcc
Version: 4.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: howard dot thomson at dial dot pipex dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36987