[Patch, fortran] Allocation tweaks

Jerry DeLisle jvdelisle@verizon.net
Tue Jul 3 05:20:00 GMT 2007


Janne Blomqvist wrote:
> :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,

This is OK.

Jerry



More information about the Fortran mailing list