Here's how it looks:

$ MANWIDTH=72 diffman-git f19bb100f31e
--- f19bb100f31e^:man/man3/aligned_alloc.3
+++ f19bb100f31e:man/man3/aligned_alloc.3
@@ -52,6 +52,41 @@ STANDARDS
 HISTORY
      glibc 2.16.  C11, POSIX.1‐2024.
 
+   C11
+     In C11, the specification of this function had several issues.
+
+     •  size had to be a multiple of alignment.  Otherwise, the behav‐
+        ior was undefined.
+
+     •  If alignment was not a power of two, the behavior was unde‐
+        fined.
+
+     DR460 reported both cases of UB as unnecessarily dangerous, and
+     fixed them with a Technical Corrigendum that transformed them into
+     errors.
+
+     N2072 reported that the requirement that size is a multiple of
+     alignment is superfluous, and removed it with a Technical Corri‐
+     gendum.
+
+     C17 incorporates both technical corrigenda.  The API has been sta‐
+     ble since C17.
+
+     glibc originally implemented it as silently aligning as
+     stdc_bit_ceil(alignment) instead of alignment.  Since glibc 2.38,
+     it implements the C17 specification.
+
+     Some implementations, such as FreeBSD/jemalloc, implement the C17
+     specification, even though their documentation claims the C11
+     specification.
+
+     Some implementations, such as OpenBSD, implement C11 amended with
+     DR460, even though their documentation claims having undefined be‐
+     havior.
+
+     No known implementations have exploited the undefined behavior in
+     a more dangerous way.  This function should be safe to use.
+
 NOTES
      On many systems there are alignment restrictions, for example, on
      buffers used for direct block device I/O.  POSIX specifies the


-- 
<https://www.alejandro-colomar.es>

Attachment: signature.asc
Description: PGP signature

Reply via email to