[Patch, fortran] Allocation tweaks
Janne Blomqvist
blomqvist.janne@gmail.com
Mon Jul 2 20:29:00 GMT 2007
:ADDPATCH fortran:
Hi,
the attached patch does a few minor tweaks to the allocation functions:
1) In the frontend, mark internal_realloc as a malloc function. From
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html:
"realloc-like functions have this property as long as the old pointer is
never referred to (including comparing it to the new pointer) after the
function returns a non-NULL value."
From looking at the source, gfortran never seems to touch the old pointer.
2) In libgfortran, mark internal_malloc_size as a malloc function.
3) In runtime/memory.c, combine a few functions, since we no longer have
separate entry points for GFC_INTEGER_4 and GFC_INTEGER_8 sizes. Also,
much of the logic in internal_realloc_size was unnecessary duplication
of the semantics of the libc realloc function, so most of that is removed.
4) Mark memory.c(allocate) as a malloc function, since this function is
called by other functions in memory.c (though I think unit-at-a-time
should catch this, but it won't hurt anyway).
Regtested on i686-pc-linux-gnu, ok for trunk?
--
Janne Blomqvist
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ChangeLog
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070702/ad70e17e/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alloc-cleanup.diff
Type: text/x-patch
Size: 3352 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070702/ad70e17e/attachment.bin>
More information about the Fortran
mailing list