diff mbox

[fortran,pr65548,2nd,take,v5,5/6,Regression] gfc_conv_procedure_call

Message ID 20150520102439.0aa1ce5c@vepi2
State New
Headers show

Commit Message

Andre Vehreschild May 20, 2015, 8:24 a.m. UTC
Hi Mikael,

when I got you right on IRC, then you proposed this change about the pointer
attribute:


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

Comments

Mikael Morin May 20, 2015, 1:23 p.m. UTC | #1
Le 20/05/2015 10:24, Andre Vehreschild a écrit :
> 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?
> 
You can drop the else branch.  OK to commit with that change.
Thanks.

Mikael
diff mbox

Patch

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;