Hi Joseph, On Mon, Jun 16, 2025 at 11:39:48PM +0000, Joseph Myers wrote: > On Mon, 16 Jun 2025, Alejandro Colomar wrote: > > > Since glibc and Bionic are the two implementations that are currently > > broken, could you please fix your implementations? I'm sure the > > C Committee will be much easier to convince if the implentations have > > changed in a clear direction. > > > > But if the committee says we're not fixing ISO C until the > > implementations are fixed, and the implementations (you) refuse to > > accept the fix until the committee standardizes something, then we'll > > have the problem forever. > > I think a better way to eliminate UB here would be to require this > erroneous case to terminate execution. The sequence of changes to > semantics in past standard versions means that it's always a bad idea for > applications to try to use realloc with size 0 and preventing them more > strongly from doing so seems better to me than defining semantics that an > application might then be able to use in 10-15 years' time.
You'd be imposing a breakage of libc implementations that have never been broken, such as musl, and probably also the BSDs. I bet they'll ignore the standard if it decides to irremediably break their implementations without a reason. You're allowed to break glibc beyond repair under the letter of the standard, since UB allows you to terminate execution. However, I don't see you convincing musl and the BSDs to break what isn't broken. The standard has been broken, and implementations written by the letter of the standard have been equally broken. However, most implementations are sane; especially those that descend from UNIX V7. Have a lovely night! Alex -- <https://www.alejandro-colomar.es/>
signature.asc
Description: PGP signature