This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: RFA, PR fortran/34686: Aliasing bug when returning character pointers
- From: Tobias Burnus <burnus at net-b dot de>
- To: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org, rsandifo at nildram dot co dot uk
- Date: Fri, 18 Jan 2008 01:29:43 +0100
- Subject: Re: RFA, PR fortran/34686: Aliasing bug when returning character pointers
- References: <87wsqkhcky.fsf@firetop.home> <478B2702.1080804@net-b.de>
Tobias Burnus wrote:
> Richard Sandiford wrote:
>
>> Bootstrapped & regression-tested on x86_64-linux-gnu. Also regression-
>> tested on mips64-linux-gnu (all 3 ABIs). OK to install?
>>
>>
> OK with a fortran/Changelog entry.
>
I committed it now. (Rev. 131620.)
Thanks for the patch.
Tobias
>> Index: gcc/fortran/trans-expr.c
>> ===================================================================
>> --- gcc/fortran/trans-expr.c 2008-01-07 10:48:25.000000000 +0000
>> +++ gcc/fortran/trans-expr.c 2008-01-07 10:48:29.000000000 +0000
>> @@ -2660,13 +2660,7 @@ gfc_conv_function_call (gfc_se * se, gfc
>> character pointers. */
>> if (sym->attr.pointer || sym->attr.allocatable)
>> {
>> - /* Build char[0:len-1] * pstr. */
>> - tmp = fold_build2 (MINUS_EXPR, gfc_charlen_type_node, len,
>> - build_int_cst (gfc_charlen_type_node, 1));
>> - tmp = build_range_type (gfc_array_index_type,
>> - gfc_index_zero_node, tmp);
>> - tmp = build_array_type (gfc_character1_type_node, tmp);
>> - var = gfc_create_var (build_pointer_type (tmp), "pstr");
>> + var = gfc_create_var (type, "pstr");
>>
>> /* Provide an address expression for the function arguments. */
>> var = build_fold_addr_expr (var)
>>
>
>