https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100262

--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
I should add: because mdesc is a member of another struct it can't have a
flexible array member, but as long as the enclosing struct mdesc_handle is not
embedded as a member in another struct it can have a trailing flexible array
member, like so:

struct mdesc_handle {
 struct list_head list;
 struct mdesc_mem_ops *mops;
 void *self_base;
 refcount_t refcnt;
 unsigned int handle_size;
 struct mdesc_hdr mdesc;
 char data[];
};

Then changing the accesses from the end of mdesc to those from the beginning of
the data array would also correct the problem and presumably be a cleaner way
of writing the code.

Reply via email to