This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/52944] [4.5/4.6 Regression] __builtin_object_size(..., 1) no longer returns (size_t)-1 for consecutive flexible/zero-length array members
- From: "vapier at gentoo dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 12 Apr 2012 15:13:25 +0000
- Subject: [Bug other/52944] [4.5/4.6 Regression] __builtin_object_size(..., 1) no longer returns (size_t)-1 for consecutive flexible/zero-length array members
- Auto-submitted: auto-generated
- References: <bug-52944-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52944
Mike Frysinger <vapier at gentoo dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |4.4.7
Known to fail| |4.5.3, 4.6.3
--- Comment #2 from Mike Frysinger <vapier at gentoo dot org> 2012-04-12 15:13:25 UTC ---
if you look at the tftp example, you'd see that your proposed struct does not
work. the protocol needs two flexible array members at different starting
points.
the 96 isn't conservative in this case, it's correct. i declared a buffer of
100 bytes, so buf[0] can cover 96 bytes (as the leading integer is 32bits). is
there a "simplish" patch that could be backported to the 4.5/4.6 branches for
that ?
thinking a bit more, the requirements can probably be pulled off with more
anonymous unions/structs like so:
struct tftphdr {
short opcode;
union {
struct {
union {
unsigned short tu_block;
short tu_code;
};
char tu_data[0];
};
char tu_stuff[0];
} __attribute__ ((__packed__));
} __attribute__ ((__packed__));