Re: [wish] Flexible array members in unions

2023-05-19 Thread Martin Uecker via Gcc
Am Donnerstag, dem 18.05.2023 um 20:59 + schrieb Qing Zhao: > > > On May 18, 2023, at 12:25 PM, Martin Uecker via Gcc wrote: > > > > > > > > > On Thu, May 11, 2023 at 11:14 PM Kees Cook via Gcc > > > wrote: > > > > > > > > On Thu, May 11, 2023 at 08:53:52PM +, Joseph Myers wrote: >

Re: [wish] Flexible array members in unions

2023-05-18 Thread Qing Zhao via Gcc
> On May 18, 2023, at 12:25 PM, Martin Uecker via Gcc wrote: > > > >> On Thu, May 11, 2023 at 11:14 PM Kees Cook via Gcc wrote: >>> >>> On Thu, May 11, 2023 at 08:53:52PM +, Joseph Myers wrote: On Thu, 11 May 2023, Kees Cook via Gcc wrote: > On Thu, May 11, 2023 at

Re: [wish] Flexible array members in unions

2023-05-18 Thread Martin Uecker via Gcc
> On Thu, May 11, 2023 at 11:14 PM Kees Cook via Gcc wrote: > > > > On Thu, May 11, 2023 at 08:53:52PM +, Joseph Myers wrote: > > > On Thu, 11 May 2023, Kees Cook via Gcc wrote: > > > > > > > On Thu, May 11, 2023 at 06:29:10PM +0200, Alejandro Colomar wrote: > > > > > On 5/11/23 18:07,

Re: [wish] Flexible array members in unions

2023-05-15 Thread Qing Zhao via Gcc
> On May 12, 2023, at 2:16 AM, Richard Biener via Gcc wrote: > > On Thu, May 11, 2023 at 11:14 PM Kees Cook via Gcc wrote: >> >> On Thu, May 11, 2023 at 08:53:52PM +, Joseph Myers wrote: >>> On Thu, 11 May 2023, Kees Cook via Gcc wrote: >>> On Thu, May 11, 2023 at 06:29:10PM +0200,

Re: [wish] Flexible array members in unions

2023-05-12 Thread David Brown via Gcc
On 12/05/2023 08:16, Richard Biener via Gcc wrote: On Thu, May 11, 2023 at 11:14 PM Kees Cook via Gcc wrote: On Thu, May 11, 2023 at 08:53:52PM +, Joseph Myers wrote: On Thu, 11 May 2023, Kees Cook via Gcc wrote: On Thu, May 11, 2023 at 06:29:10PM +0200, Alejandro Colomar wrote: On

Re: [wish] Flexible array members in unions

2023-05-12 Thread Jonathan Wakely via Gcc
On Thu, 11 May 2023, 23:17 Kees Cook via Gcc, wrote: > On Thu, May 11, 2023 at 09:43:49PM +, Joseph Myers wrote: > > On Thu, 11 May 2023, Kees Cook via Gcc wrote: > > > > > Why are zero-sized objects missing in Standard C? Or, perhaps, the > better > > > question is: what's needed to support

Re: [wish] Flexible array members in unions

2023-05-12 Thread Richard Biener via Gcc
On Thu, May 11, 2023 at 11:14 PM Kees Cook via Gcc wrote: > > On Thu, May 11, 2023 at 08:53:52PM +, Joseph Myers wrote: > > On Thu, 11 May 2023, Kees Cook via Gcc wrote: > > > > > On Thu, May 11, 2023 at 06:29:10PM +0200, Alejandro Colomar wrote: > > > > On 5/11/23 18:07, Alejandro Colomar

Re: [wish] Flexible array members in unions

2023-05-11 Thread Alejandro Colomar via Gcc
Hi Joseph, Kees, On 5/12/23 00:52, Joseph Myers wrote: > On Thu, 11 May 2023, Kees Cook via Gcc wrote: > >> Okay, understood. If this is a C-only thing, we can ignore the C++ >> impact. > > We're a lot more careful lately in WG14 about checking for C++ > compatibility issues and expecting

Re: [wish] Flexible array members in unions

2023-05-11 Thread Joseph Myers
On Thu, 11 May 2023, Kees Cook via Gcc wrote: > Okay, understood. If this is a C-only thing, we can ignore the C++ > impact. We're a lot more careful lately in WG14 about checking for C++ compatibility issues and expecting approval from the liaison group for anything with possible

Re: [wish] Flexible array members in unions

2023-05-11 Thread Kees Cook via Gcc
On Thu, May 11, 2023 at 09:43:49PM +, Joseph Myers wrote: > On Thu, 11 May 2023, Kees Cook via Gcc wrote: > > > Why are zero-sized objects missing in Standard C? Or, perhaps, the better > > question is: what's needed to support the idea of a zero-sized object? > > Zero-sized objects break

Re: [wish] Flexible array members in unions

2023-05-11 Thread Joseph Myers
On Thu, 11 May 2023, Kees Cook via Gcc wrote: > Why are zero-sized objects missing in Standard C? Or, perhaps, the better > question is: what's needed to support the idea of a zero-sized object? Zero-sized objects break the principle that different objects have different addresses, and the

Re: [wish] Flexible array members in unions

2023-05-11 Thread Kees Cook via Gcc
On Thu, May 11, 2023 at 08:53:52PM +, Joseph Myers wrote: > On Thu, 11 May 2023, Kees Cook via Gcc wrote: > > > On Thu, May 11, 2023 at 06:29:10PM +0200, Alejandro Colomar wrote: > > > On 5/11/23 18:07, Alejandro Colomar wrote: > > > [...] > > > > Would you allow flexible array members in

Re: [wish] Flexible array members in unions

2023-05-11 Thread Joseph Myers
On Thu, 11 May 2023, Kees Cook via Gcc wrote: > On Thu, May 11, 2023 at 06:29:10PM +0200, Alejandro Colomar wrote: > > On 5/11/23 18:07, Alejandro Colomar wrote: > > [...] > > > Would you allow flexible array members in unions? Is there any > > > strong reason to disallow them? > > Yes please!!

Re: [wish] Flexible array members in unions

2023-05-11 Thread Kees Cook via Gcc
On Thu, May 11, 2023 at 06:29:10PM +0200, Alejandro Colomar wrote: > On 5/11/23 18:07, Alejandro Colomar wrote: > [...] > > Would you allow flexible array members in unions? Is there any > > strong reason to disallow them? Yes please!! And alone in a struct, too. AFAICT, there is no

Re: [wish] Flexible array members in unions

2023-05-11 Thread Alejandro Colomar via Gcc
[CC += Kees, Andrew] [start of thread: ] On 5/11/23 18:07, Alejandro Colomar wrote: > Hi! > > Currently, one can have pseudo-flexible array members in unions with > [0] syntax, but it's not allowed with []

[wish] Flexible array members in unions

2023-05-11 Thread Alejandro Colomar via Gcc
Hi! Currently, one can have pseudo-flexible array members in unions with [0] syntax, but it's not allowed with [] syntax. Here's an example of how it is possible today: struct s { ... size_t n; union { ptrdiff_t off[0]; // [n]; offsets from s->data.