Re: [PATCH v2] socket: Implement sockaddr_storage with an anonymous union

2023-01-22 Thread Bastien Roucariès
Le samedi 21 janvier 2023, 14:30:11 UTC Alejandro Colomar a écrit : > Hi Bastien, > > On 1/21/23 14:30, Bastien Roucariès wrote: > > [...] > > >> Ahh, indeed it seems to be UB. It's in the same 6.5.2.3/6: there's a > >> requirement that the information about the union is kept in the function i

Re: [PATCH v2] socket: Implement sockaddr_storage with an anonymous union

2023-01-21 Thread Alejandro Colomar via Gcc
Hi Bastien, On 1/21/23 14:30, Bastien Roucariès wrote: [...] Ahh, indeed it seems to be UB. It's in the same 6.5.2.3/6: there's a requirement that the information about the union is kept in the function in which it's accessed. The standard presents an example, which is a bit ambiguous:

Re: [PATCH v2] socket: Implement sockaddr_storage with an anonymous union

2023-01-21 Thread Bastien Roucariès
Le samedi 21 janvier 2023, 03:17:39 UTC Alejandro Colomar a écrit : > Hi Zack, > > On 1/21/23 03:38, Alejandro Colomar wrote: > > Hi Zack, > > > > On 1/20/23 20:25, Alejandro Colomar wrote: > >> [CC += GCC] // pun not intended :P > >> > >> Hi Zack, > >> > >> On 1/20/23 19:04, Zack Weinberg wrote

Re: [PATCH v2] socket: Implement sockaddr_storage with an anonymous union

2023-01-20 Thread Alejandro Colomar via Gcc
Hi Zack, On 1/21/23 03:38, Alejandro Colomar wrote: Hi Zack, On 1/20/23 20:25, Alejandro Colomar wrote: [CC += GCC]  // pun not intended :P Hi Zack, On 1/20/23 19:04, Zack Weinberg wrote: On Fri, Jan 20, 2023, at 8:40 AM, Alejandro Colomar wrote: The historical design of `sockaddr_storage`

Re: [PATCH v2] socket: Implement sockaddr_storage with an anonymous union

2023-01-20 Thread Alejandro Colomar via Gcc
Hi Zack, On 1/20/23 20:25, Alejandro Colomar wrote: [CC += GCC]  // pun not intended :P Hi Zack, On 1/20/23 19:04, Zack Weinberg wrote: On Fri, Jan 20, 2023, at 8:40 AM, Alejandro Colomar wrote: The historical design of `sockaddr_storage` makes it impossible to use without breaking strict al

Re: [PATCH v2] socket: Implement sockaddr_storage with an anonymous union

2023-01-20 Thread Alejandro Colomar via Gcc
On 1/20/23 21:46, Bastien Roucariès wrote: Le vendredi 20 janvier 2023, 20:38:32 UTC Alejandro Colomar a écrit : Hi Bastien, On 1/20/23 21:32, Bastien Roucariès wrote: [...] diff --git a/bits/socket.h b/bits/socket.h index aac8c49b00..c0c23b4e84 100644 --- a/bits/socket.h +++ b/bits/socket.

Re: [PATCH v2] socket: Implement sockaddr_storage with an anonymous union

2023-01-20 Thread Bastien Roucariès
Le vendredi 20 janvier 2023, 20:38:32 UTC Alejandro Colomar a écrit : > Hi Bastien, > > On 1/20/23 21:32, Bastien Roucariès wrote: > [...] > > >> diff --git a/bits/socket.h b/bits/socket.h > >> index aac8c49b00..c0c23b4e84 100644 > >> --- a/bits/socket.h > >> +++ b/bits/socket.h > >> @@ -168,9 +1

Re: [PATCH v2] socket: Implement sockaddr_storage with an anonymous union

2023-01-20 Thread Alejandro Colomar via Gcc
Hi Bastien, On 1/20/23 21:32, Bastien Roucariès wrote: [...] diff --git a/bits/socket.h b/bits/socket.h index aac8c49b00..c0c23b4e84 100644 --- a/bits/socket.h +++ b/bits/socket.h @@ -168,9 +168,14 @@ struct sockaddr struct sockaddr_storage { -__SOCKADDR_COMMON (ss_); /* Address

Re: [PATCH v2] socket: Implement sockaddr_storage with an anonymous union

2023-01-20 Thread Alejandro Colomar via Gcc
[CC += GCC] // pun not intended :P Hi Zack, On 1/20/23 19:04, Zack Weinberg wrote: On Fri, Jan 20, 2023, at 8:40 AM, Alejandro Colomar wrote: The historical design of `sockaddr_storage` makes it impossible to use without breaking strict aliasing rules. Not only this type is unusable, but eve