[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 12/14] doc: mention Solaris malloc ENOMEM issues
From: |
Bruno Haible |
Subject: |
Re: [PATCH 12/14] doc: mention Solaris malloc ENOMEM issues |
Date: |
Tue, 05 Nov 2024 16:40:13 +0100 |
Paul Eggert wrote:
> diff --git a/doc/posix-functions/malloc.texi b/doc/posix-functions/malloc.texi
> index 31e199e43a..6a6f3c1059 100644
> --- a/doc/posix-functions/malloc.texi
> +++ b/doc/posix-functions/malloc.texi
> @@ -12,7 +12,7 @@ Portability problems fixed by Gnulib:
> @item
> Upon failure, the function does not set @code{errno} to @code{ENOMEM} on
> some platforms:
> -mingw, MSVC 14.
> +mingw, MSVC 14, Solaris 11.4.
Huh? Solaris is not known for blatant POSIX violations, and the unit test
that I added in tests/test-malloc-posix.c on 2024-10-31 passed on Solaris 11.4
(with gcc).
What did your test program look like? Are you sure you didn't encounter
the clang bug <https://github.com/llvm/llvm-project/issues/114772> ?
My test program
========================================================
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <errno.h>
int main () {
void * volatile p;
errno = 0;
p = malloc (SIZE_MAX / 2 + 10);
printf ("p = %p, errno = %d\n", p, errno);
errno = 0;
p = malloc (SIZE_MAX / 10);
printf ("p = %p, errno = %d\n", p, errno);
errno = 0;
p = malloc (SIZE_MAX / 100);
printf ("p = %p, errno = %d\n", p, errno);
errno = 0;
p = malloc (SIZE_MAX / 1000);
printf ("p = %p, errno = %d\n", p, errno);
}
=========================================================
prints this on Solaris 11.4:
p = 0, errno = 12
p = 0, errno = 12
p = 0, errno = 12
p = 0, errno = 12
Bruno
- Re: [PATCH 07/14] realloc-posix: realloc (..., 0) now returns nonnull, (continued)
- [PATCH 08/14] realloc-posix: set CHERI bounds, Paul Eggert, 2024/11/05
- [PATCH 09/14] stdlib: make MB_CUR_MAX usable from extern inline, Paul Eggert, 2024/11/05
- [PATCH 10/14] realloc-posix: use _GL_USE_STDLIB_ALLOC, Paul Eggert, 2024/11/05
- [PATCH 11/14] realloc-posix: tune for glibc-like, Paul Eggert, 2024/11/05
- [PATCH 12/14] doc: mention Solaris malloc ENOMEM issues, Paul Eggert, 2024/11/05
- Re: [PATCH 12/14] doc: mention Solaris malloc ENOMEM issues,
Bruno Haible <=
- [PATCH 13/14] realloc-posix: update doc, Paul Eggert, 2024/11/05
- [PATCH 14/14] argz: defend against realloc (0, 0), Paul Eggert, 2024/11/05