Re: *ping* [patch, fortran] Inline argument packing

2019-05-18 Thread Steve Kargl
On Sat, May 18, 2019 at 09:15:00PM +0200, Thomas Koenig wrote:
> Am 11.05.19 um 15:10 schrieb Thomas Koenig:
> > Hello world,
> > 
> > this new version of the inlie argument packing patch (PR 88821)
> > avoids the ICE on the test case for PR 61968. Otherwise it is
> > unchanged.
> > 
> > Regression-tested. OK for trunk?
> 
> Ping?

OK.

-- 
Steve


*ping* [patch, fortran] Inline argument packing

2019-05-18 Thread Thomas Koenig

Am 11.05.19 um 15:10 schrieb Thomas Koenig:

Hello world,

this new version of the inlie argument packing patch (PR 88821)
avoids the ICE on the test case for PR 61968. Otherwise it is
unchanged.

Regression-tested. OK for trunk?


Ping?


Re: [patch, fortran] Inline argument packing

2019-05-11 Thread Dominique d'Humières



> Le 11 mai 2019 à 15:49, Thomas Koenig  a écrit :
> 
> Hi Dominique,
> 
>> How ever adding the new tests is a real PITA!-(
>> Could you improve the naming scheme for them
> 
> What should be the preferrred naming scheme for a
> test that is split?  I'm open to suggestions (but also,
> the naming convention should not matter once the test
> cases are committed).

Well, when the naming I use for testing does not correspond to the one
committed I have to clean the mess!-(

You have attachments for typebound_assignment_5a.f90 and 
typebound_assignment_6a.f90
It would be nice to have similar attachments for the other splits. Also I can 
guess the names for
the new tests, but it would help to have them in the same order as in the mail.

(I think you should really use the +N option for the diff).

Dominique
 
> 
> Regards
> 
>   Thomas



Re: [patch, fortran] Inline argument packing

2019-05-11 Thread Thomas Koenig

Hi Dominique,


How ever adding the new tests is a real PITA!-(
Could you improve the naming scheme for them


What should be the preferrred naming scheme for a
test that is split?  I'm open to suggestions (but also,
the naming convention should not matter once the test
cases are committed).

Regards

Thomas


Re: [patch, fortran] Inline argument packing

2019-05-11 Thread Dominique d'Humières
Hi Thomas,

I confirm that the new patch fixes the ICE.

How ever adding the new tests is a real PITA!-(
Could you improve the naming scheme for them

TIA

Dominique


[patch, fortran] Inline argument packing

2019-05-11 Thread Thomas Koenig

Hello world,

this new version of the inlie argument packing patch (PR 88821)
avoids the ICE on the test case for PR 61968. Otherwise it is
unchanged.

Regression-tested. OK for trunk?

Regards

Thomas

2019-05-11  Thomas Koenig  

PR fortran/88821
* expr.c (gfc_is_simply_contiguous): Return true for
an EXPR_ARRAY.
* trans-array.c (is_pointer): New function.
(gfc_conv_array_parameter): Call gfc_conv_subref_array_arg
when not optimizing and not optimizing for size if the formal
arg is passed by reference.
* trans-expr.c (gfc_conv_subref_array_arg): Add arguments
fsym, proc_name and sym.  Add run-time warning for temporary
array creation.  Wrap argument if passing on an optional
argument to an optional argument.
* trans.h (gfc_conv_subref_array_arg): Add optional arguments
fsym, proc_name and sym to prototype.

2019-05-11  Thomas Koenig  

PR fortran/88821
* gfortran.dg/alloc_comp_auto_array_3.f90: Add -O0 to dg-options
to make sure the test for internal_pack is retained.
* gfortran.dg/assumed_type_2.f90: Split compile and run time
tests into this and
* gfortran.dg/assumed_type_2a.f90: New file.
* gfortran.dg/c_loc_test_22.f90: Likewise.
* gfortran.dg/contiguous_3.f90: Likewise.
* gfortran.dg/internal_pack_11.f90: Likewise.
* gfortran.dg/internal_pack_12.f90: Likewise.
* gfortran.dg/internal_pack_16.f90: Likewise.
* gfortran.dg/internal_pack_17.f90: Likewise.
* gfortran.dg/internal_pack_18.f90: Likewise.
* gfortran.dg/internal_pack_4.f90: Likewise.
* gfortran.dg/internal_pack_5.f90: Add -O0 to dg-options
to make sure the test for internal_pack is retained.
* gfortran.dg/internal_pack_6.f90: Split compile and run time
tests into this and
* gfortran.dg/internal_pack_6a.f90: New file.
* gfortran.dg/internal_pack_8.f90: Likewise.
* gfortran.dg/missing_optional_dummy_6: Split compile and run time
tests into this and
* gfortran.dg/missing_optional_dummy_6a.f90: New file.
* gfortran.dg/no_arg_check_2.f90: Split compile and run time tests
into this and
* gfortran.dg/no_arg_check_2a.f90: New file.
* gfortran.dg/typebound_assignment_5.f90: Split compile and run time
tests into this and
* gfortran.dg/typebound_assignment_5a.f90: New file.
* gfortran.dg/typebound_assignment_6.f90: Split compile and run time
tests into this and
* gfortran.dg/typebound_assignment_6a.f90: New file.
* gfortran.dg/internal_pack_19.f90: New file.
* gfortran.dg/internal_pack_20.f90: New file.
* gfortran.dg/internal_pack_21.f90: New file.
Index: fortran/expr.c
===
--- fortran/expr.c	(Revision 270622)
+++ fortran/expr.c	(Arbeitskopie)
@@ -5713,6 +5713,9 @@ gfc_is_simply_contiguous (gfc_expr *expr, bool str
   gfc_ref *ref, *part_ref = NULL;
   gfc_symbol *sym;
 
+  if (expr->expr_type == EXPR_ARRAY)
+return true;
+
   if (expr->expr_type == EXPR_FUNCTION)
 {
   if (expr->value.function.esym)
Index: fortran/trans-array.c
===
--- fortran/trans-array.c	(Revision 270622)
+++ fortran/trans-array.c	(Arbeitskopie)
@@ -7869,6 +7869,23 @@ array_parameter_size (tree desc, gfc_expr *expr, t
 			   *size, fold_convert (gfc_array_index_type, elem));
 }
 
+/* Helper function - return true if the argument is a pointer.  */
+ 
+static bool
+is_pointer (gfc_expr *e)
+{
+  gfc_symbol *sym;
+
+  if (e->expr_type != EXPR_VARIABLE ||  e->symtree == NULL)
+return false;
+
+  sym = e->symtree->n.sym;
+  if (sym == NULL)
+return false;
+
+  return sym->attr.pointer || sym->attr.proc_pointer;
+}
+
 /* Convert an array for passing as an actual parameter.  */
 
 void
@@ -8120,6 +8137,20 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr *
 			 "Creating array temporary at %L", >where);
 	}
 
+  /* When optmizing, we can use gfc_conv_subref_array_arg for
+	 making the packing and unpacking operation visible to the
+	 optimizers.  */
+
+  if (g77 && optimize && !optimize_size && expr->expr_type == EXPR_VARIABLE
+	  && !is_pointer (expr) && (fsym == NULL
+|| fsym->ts.type != BT_ASSUMED))
+	{
+	  gfc_conv_subref_array_arg (se, expr, g77,
+ fsym ? fsym->attr.intent : INTENT_INOUT,
+ false, fsym, proc_name, sym);
+	  return;
+	}
+
   ptr = build_call_expr_loc (input_location,
 			 gfor_fndecl_in_pack, 1, desc);
 
Index: fortran/trans-expr.c
===
--- fortran/trans-expr.c	(Revision 270622)
+++ fortran/trans-expr.c	(Arbeitskopie)
@@ -4576,8 +4576,10 @@ gfc_apply_interface_mapping (gfc_interface_mapping
an actual argument derived type array is