public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* gcc-14 Wflex-array-member-not-at-end may-be-ub in struct pthread
@ 2023-07-05 13:46 Cristian Rodríguez
  2023-07-05 15:53 ` Paul Eggert
  0 siblings, 1 reply; 12+ messages in thread
From: Cristian Rodríguez @ 2023-07-05 13:46 UTC (permalink / raw)
  To: Adhemerval Zanella via Libc-alpha

[-- Attachment #1: Type: text/plain, Size: 819 bytes --]

gcc-14 says that

struct pthread {
...
  struct rseq rseq_area;

  /* This member must be last.  */
  char end_padding[]; --> This is incorrect, since struct rseq contains a
flexible array it must be the last member..

}

The current docs say:

"A structure containing a C99 flexible array member, or a union containing
such a structure, is not the last field of another structure, for example:

struct flex  { int length; char data[]; };

struct mid_flex { int m; struct flex flex_data; int n; };

In the above, accessing a member of the array mid_flex.flex_data.data[] might
have undefined behavior. Compilers do not handle such a case consistently.
Any code relying on this case should be modified to ensure that flexible
array members only end up at the ends of structures."


Who is right.. ? is this intentional?

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-07-19 21:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-05 13:46 gcc-14 Wflex-array-member-not-at-end may-be-ub in struct pthread Cristian Rodríguez
2023-07-05 15:53 ` Paul Eggert
2023-07-05 18:13   ` Cristian Rodríguez
2023-07-08 19:21     ` Cristian Rodríguez
2023-07-19 14:17       ` Adhemerval Zanella Netto
2023-07-19 14:22         ` Adhemerval Zanella Netto
2023-07-19 14:55           ` Mathieu Desnoyers
2023-07-19 15:28             ` Adhemerval Zanella Netto
2023-07-19 18:36         ` Andreas K. Huettel
2023-07-19 19:04           ` Siddhesh Poyarekar
2023-07-19 21:16             ` Paul Eggert
2023-07-19 21:49               ` Andreas K. Huettel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).