Bruno Haible <[email protected]> writes:

> Collin Funk wrote:
>> FreeBSD 15.0 was released today.
>
> In a testdir, I see a test failure:
>
> FAIL: test-realloc-posix
> ========================
>
> ../../gltests/test-realloc-posix.c:66: assertion 'errno == ENOMEM' failed
> FAIL test-realloc-posix (exit status: 134)
>
> The reason is that realloc (p, size) sets errno when failing only when
> size <= 0x700000000000000; it leaves errno untouched if
> size > 0x700000000000000.
>
> This patch provides a workaround.
>
> Collin, if you want to send a bug report to the FreeBSD people, here's
> my test program:
> =========================== foo.c ===========================
> #include <errno.h>
> #include <stdint.h>
> #include <stdio.h>
> #include <stdlib.h>
> int main (int argc, char *argv[])
> {
>   size_t b = (argc > 1 ? atol (argv[1]) : PTRDIFF_MAX + 1);
>   errno = 1729;
>   void *p = malloc (1);
>   printf ("p = 0x%lx, errno = %d\n", (unsigned long) p, errno);
>   p = realloc (p, b);
>   printf ("p = 0x%lx, errno = %d\n", (unsigned long) p, errno);
> }
> ===============================================================

Sure, I can report it. Thanks.

Whether it will be fixed or not I am unsure. FreeBSD still uses
jemalloc, AFAIK. The upstream jemalloc has been unmaintained for a few
months. I thought I would hear about someone taking it over by now, but
I haven't.

Collin

Reply via email to