[gfortran] Add malloc and free intrinsics

Steven Bosscher stevenb@suse.de
Sat Oct 29 20:16:00 GMT 2005


On Saturday 29 October 2005 21:35, Steve Kargl wrote:
> In your malloc and free functions, should we add a
> pedantic cast, i.e, malloc((size_t) *size) and
> free((void *) *ptr).

Maybe we should verify that the integer size is large enough
to hold a pointer.  I don't know how hard that is, especially
for targets that support multiple pointer sizes...

> I haven't located docs yet for 
> malloc.

Some docs are here:
http://docs.sun.com/app/docs/doc/805-4939/6j4m0vn6u?a=view

> What is the expected behavior for negative 
> values?  What happens if malloc(*size) fails and returns
> NULL?

We chatted a bit on IRC a bit and found out that what we probably
want, is for MALLOC to silently return 0 in all error conditions
(negative values, OOM, etc.).  No errors or warnings, just return 0.

Gr.
Steven



More information about the Fortran mailing list