[DragonFlyBSD - Bug #3114] Using malloc(size_max) gives strange results

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Sun Dec 31 04:14:29 PST 2017


Issue #3114 has been updated by ddegroot.

File test_malloc.c added

Update test_malloc.c

----------------------------------------
Bug #3114: Using malloc(size_max) gives strange results
http://bugs.dragonflybsd.org/issues/3114#change-13369

* Author: ddegroot
* Status: New
* Priority: Normal
* Assignee: 
* Category: Userland
* Target version: 5.0.0
----------------------------------------
While porting d-lang dmd/druntime/phobos to DragonFlyBSD, it became apparent that using 'malloc(size_t)' to deduce malloc and alignment rules, gave some unexpected results.

Example:
malloc size:9223372036854775807, malloc failed, ptr == NULL, errno:12                       // expected result (INTPTR_MAX)
malloc size:72036854775808,  ptr == 0x800800000                                             // this is fine
malloc size:18446744073709551613,  ptr == 0x800455000                                       // unexpected UINTPTR_MAX / SIZE_MAX

Related dlang:druntime PR: https://github.com/dlang/druntime/pull/1999

---Files--------------------------------
test_malloc.c (1.01 KB)
test_malloc_results.txt (1.97 KB)
nmalloc.c.diff (1.81 KB)
test_malloc.c (1.11 KB)


-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



More information about the Bugs mailing list