This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran, patch] PR 25806: Functions returning pointers to arrays
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: Erik Edelmann <erik dot edelmann at iki dot fi>
- Cc: gfortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 12 Feb 2006 14:10:25 +0100
- Subject: Re: [gfortran, patch] PR 25806: Functions returning pointers to arrays
- References: <20060205200619.GA16702@acclab.helsinki.fi>
Erik Edelmann wrote:
> 2006-02-05 Erik Edelmann <eedelman@gcc.gnu.org>
>
> PR fortran/25806
> * trans-array.c (gfc_trans_allocate_array_storage): New argument
> dealloc; free the temporary only if dealloc is true.
> (gfc_trans_allocate_temp_array): New argument bool dealloc, to be
> passed onwards to gfc_trans_allocate_array_storage.
> (gfc_trans_array_constructor, gfc_conv_loop_setup): Update call to
> gfc_trans_allocate_temp_array.
> * trans-array.h (gfc_trans_allocate_temp_array): Update function
> prototype.
> * trans-expr.c (gfc_conv_function_call): Set new argument 'dealloc'
> to gfc_trans_allocate_temp_array to false in case of functions
> returning pointers.
> (gfc_trans_arrayfunc_assign): Return NULL for functions returning
> pointers.
>
>
> 2006-02-05 Erik Edelmann <eedelman@gcc.gnu.org>
>
> PR fortran/25806
> * gfortran.dg/ret_pointer_2.f90: New test.
This is ok, except one small thing ...
> @@ -479,9 +479,9 @@ gfc_set_loop_bounds_from_array_spec (gfc
>
>
> /* Generate code to allocate an array temporary, or create a variable to
> - hold the data. If size is NULL zero the descriptor so that so that the
> - callee will allocate the array. Also generates code to free the array
> - afterwards.
> + hold the data. If size is NULL, zero the descriptor so that so that the
^^^^^^^^^^^^^^^
> + callee will allocate the array. If DEALLOC is true, also generate code to
> + free the array afterwards.
Unnecessary duplication :-)
Thanks,
- Tobi