malloc(0) crashing with SIGABRT
Ken Brown
kbrown@cornell.edu
Thu Sep 12 17:38:00 GMT 2019
On 9/9/2019 1:13 PM, Petr Skočík wrote:
> There's been a twitter discussion on how different POSIX platforms
> handle malloc(0): https://twitter.com/sortiecat/status/1170697927804817412 .
>
> As for Cygwin, the answer appears to be "not well", but this should be
> easy to fix.
Can you show how you produced a crash? It works fine for me with the following
test program:
$ cat malloc_zero.c
#include <stdlib.h>
#include <stdio.h>
int
main ()
{
printf ("malloc (0) = %p\n", malloc (0));
}
$ gcc -Wall -o malloc_zero malloc_zero.c
$ ./malloc_zero.exe
malloc (0) = 0x8000003c0
[This is on 64-bit Cygwin. It's the same on 32-bit, but with a different address.]
Ken
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list