This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, fortran, pr65548, 2nd take, v5] [5/6 Regression] gfc_conv_procedure_call
- From: Andre Vehreschild <vehre at gmx dot de>
- To: Mikael Morin <mikael dot morin at sfr dot fr>
- Cc: GCC-Patches-ML <gcc-patches at gcc dot gnu dot org>, GCC-Fortran-ML <fortran at gcc dot gnu dot org>
- Date: Wed, 20 May 2015 10:24:39 +0200
- Subject: Re: [Patch, fortran, pr65548, 2nd take, v5] [5/6 Regression] gfc_conv_procedure_call
- Authentication-results: sourceware.org; auth=none
- References: <bug-65548-26035 at http dot gcc dot gnu dot org/bugzilla/> <bug-65548-26035-vcFxaNSRns at http dot gcc dot gnu dot org/bugzilla/> <20150325143554 dot 0343a7a7 at vepi2> <20150402122830 dot 4153db9b at vepi2> <551DD96F dot 2050706 at charter dot net> <20150407161152 dot 22629ff5 at vepi2> <20150429143101 dot 1aa5d0b4 at gmx dot de> <20150430150728 dot 17a76373 at gmx dot de> <55527874 dot 1070602 at sfr dot fr> <20150513111230 dot 73ec0ab0 at gmx dot de> <20150514114317 dot 3a3efc89 at vepi2> <20150519105016 dot 782a642d at vepi2> <555B426A dot 8030803 at sfr dot fr>
Hi Mikael,
when I got you right on IRC, then you proposed this change about the pointer
attribute:
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 6d565ae..545f778 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -5361,6 +5361,7 @@ gfc_trans_allocate (gfc_code * code)
/* Mark the symbol referenced or gfc_trans_assignment will
bug. */
newsym->n.sym->attr.referenced = 1;
+ newsym->n.sym->attr.pointer = 1;
e3rhs->expr_type = EXPR_VARIABLE;
/* Set the symbols type, upto it was BT_UNKNOWN. */
newsym->n.sym->ts = e3rhs->ts;
@@ -5374,7 +5375,6 @@ gfc_trans_allocate (gfc_code * code)
/* Set the dimension and pointer attribute for arrays
to be on the safe side. */
newsym->n.sym->attr.dimension = 1;
- newsym->n.sym->attr.pointer = 1;
newsym->n.sym->as = arr;
gfc_add_full_array_ref (e3rhs, arr);
}
Unfortunately does this lead to numerous regressions in the testsuite. For
example:
./gfortran.sh -g allocate_alloc_opt_6.f90 -o allocate_alloc_opt_6
Fortraning using ***DEVelopment*** version...
allocate_alloc_opt_6.f90:26:0:
allocate(t, source=mytype(1.0,2))
^
internal compiler error: Segmentation fault
0xe09a08 crash_signal
/home/vehre/Projekte/c_gcc_fortran2003_enhancements_cmbant_freelancer//gcc/gcc/toplev.c:380
0xa9cbe1 useless_type_conversion_p(tree_node*, tree_node*)
/home/vehre/Projekte/c_gcc_fortran2003_enhancements_cmbant_freelancer//gcc/gcc/gimple-expr.c:83
0x10622ae tree_ssa_useless_type_conversion(tree_node*)
/home/vehre/Projekte/c_gcc_fortran2003_enhancements_cmbant_freelancer//gcc/gcc/tree-ssa.c:1178
0x10622fe tree_ssa_strip_useless_type_conversions(tree_node*)
/home/vehre/Projekte/c_gcc_fortran2003_enhancements_cmbant_freelancer//gcc/gcc/tree-ssa.c:1190
0xb6c4ae gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
/home/vehre/Projekte/c_gcc_fortran2003_enhancements_cmbant_freelancer//gcc/gcc/gimplify.c:7815
0xb5e883 gimplify_modify_expr
/home/vehre/Projekte/c_gcc_fortran2003_enhancements_cmbant_freelancer//gcc/gcc/gimplify.c:4644
I therefore came to a more elaborate change (revert the above one before
testing this):
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 6d565ae..7b466de 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -5378,6 +5378,10 @@ gfc_trans_allocate (gfc_code * code)
newsym->n.sym->as = arr;
gfc_add_full_array_ref (e3rhs, arr);
}
+ else if (POINTER_TYPE_P (TREE_TYPE (expr3)))
+ newsym->n.sym->attr.pointer = 1;
+ else
+ newsym->n.sym->attr.value = 1;
/* The string length is known to. Set it for char arrays. */
if (e3rhs->ts.type == BT_CHARACTER)
newsym->n.sym->ts.u.cl->backend_decl = expr3_len;
This patch bootstraps and regtests fine again. Ok to commit?
Regards,
Andre
On Tue, 19 May 2015 16:02:18 +0200
Mikael Morin <mikael.morin@sfr.fr> wrote:
> Le 19/05/2015 10:50, Andre Vehreschild a Ãcrit :
> > Hi all,
> >
> > find attached latest version to fix 65548.
> >
> > Bootstraps and regtests ok on x86_64-linux-gnu/f21.
> >
> OK. Thanks.
>
> Mikael
--
Andre Vehreschild * Email: vehre ad gmx dot de
- References:
- Re: [Patch, fortran, pr65548, 2nd take, v3] [5/6 Regression] gfc_conv_procedure_call
- Re: [Patch, fortran, pr65548, 2nd take, v3] [5/6 Regression] gfc_conv_procedure_call
- Re: [Patch, fortran, pr65548, 2nd take, v4] [5/6 Regression] gfc_conv_procedure_call
- Re: [Patch, fortran, pr65548, 2nd take, v5] [5/6 Regression] gfc_conv_procedure_call
- Re: [Patch, fortran, pr65548, 2nd take, v5] [5/6 Regression] gfc_conv_procedure_call