[RTEMS Project] #4390: Make zero size allocation result consistent across directives

RTEMS trac trac at rtems.org
Wed Apr 21 04:43:41 UTC 2021


#4390: Make zero size allocation result consistent across directives
-----------------------------+------------------------------
 Reporter:  Sebastian Huber  |       Owner:  Sebastian Huber
     Type:  enhancement      |      Status:  assigned
 Priority:  normal           |   Milestone:  6.1
Component:  admin            |     Version:  6
 Severity:  normal           |  Resolution:
 Keywords:                   |  Blocked By:
 Blocking:                   |
-----------------------------+------------------------------

Comment (by Sebastian Huber):

 It is not undefined behaviour in the latest POSIX edition:

 https://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html

 It is implementation-defined behaviour. The implementation has two
 options. The RTEMS malloc( 0 ) returns NULL. Linux seems to return a
 unique pointer.

 The rtems_memalign(&p, 8, 0) returns a unique pointer. I think this size
 == 0 behaviour should be consistent in RTEMS.

--
Ticket URL: <http://devel.rtems.org/ticket/4390#comment:3>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list