Re: [PATCH, Fortran, cosmetics] Use convenience functions and constants

2016-12-03 Thread Steve Kargl
On Sat, Dec 03, 2016 at 06:25:19PM +0100, Andre Vehreschild wrote:
> 
> Er, thanks for the review and sorry, but I fear I already committed
> the changes as part of r243021. These improvables occurred to me
> while hacking at:
> 
> [PATCH, Fortran, accaf, v1] Add caf-API-calls to asynchronously handle
> allocatable components in derived type coarrays.
> https://gcc.gnu.org/ml/fortran/2016-11/msg00267.html
> 
> so they sled in with committing those changes and got a suitable
> Changelog-entry
> while at it.
> 
> Thanks again for the review though.
> 

No problem.  I started at the bottom of my mail queue looking
for unreviewed patches.  I did not see one for your patch, so
read through it and found no issues.

-- 
Steve


Re: [PATCH, Fortran, cosmetics] Use convenience functions and constants

2016-12-03 Thread Andre Vehreschild
Hi Steve,

Er, thanks for the review and sorry, but I fear I already committed the changes
as part of r243021. These improvables occurred to me while hacking at:

[PATCH, Fortran, accaf, v1] Add caf-API-calls to asynchronously handle
allocatable components in derived type coarrays.
https://gcc.gnu.org/ml/fortran/2016-11/msg00267.html

so they sled in with committing those changes and got a suitable Changelog-entry
while at it.

Thanks again for the review though.

- Andre

On Sat, 3 Dec 2016 09:05:23 -0800
Steve Kargl  wrote:

> On Tue, Nov 22, 2016 at 06:56:16PM +0100, Andre Vehreschild wrote:
> > 
> > during more hacking on the allocatable components in derived type coarrays,
> > I encountered the improvable code fragments in the patch attached.
> > 
> > Bootstraps and regtests ok on x86_64-linux/F23. Ok for trunk?
> >   
> 
> OK with a suitable ChangeLog entry.
> 


-- 
Andre Vehreschild * Email: vehre ad gmx dot de 


Re: [PATCH, Fortran, cosmetics] Use convenience functions and constants

2016-12-03 Thread Steve Kargl
On Tue, Nov 22, 2016 at 06:56:16PM +0100, Andre Vehreschild wrote:
> 
> during more hacking on the allocatable components in derived type coarrays, I
> encountered the improvable code fragments in the patch attached.
> 
> Bootstraps and regtests ok on x86_64-linux/F23. Ok for trunk?
> 

OK with a suitable ChangeLog entry.

-- 
Steve


[PATCH, Fortran, cosmetics] Use convenience functions and constants

2016-11-22 Thread Andre Vehreschild
Hi all,

during more hacking on the allocatable components in derived type coarrays, I
encountered the improvable code fragments in the patch attached.

Bootstraps and regtests ok on x86_64-linux/F23. Ok for trunk?

Regards,
Andre

PS: The patch that motivated these changes follows as soon as its regtesting
has finished.
-- 
Andre Vehreschild * Email: vehre ad gmx dot de 


cosmetics_4.clog
Description: Binary data
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 1708f7c..45e1369 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -7855,9 +7859,7 @@ duplicate_allocatable (tree dest, tree src, tree type, int rank,

   if (!GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (dest)))
 {
-  tmp = null_pointer_node;
-  tmp = fold_build2_loc (input_location, MODIFY_EXPR, type, dest, tmp);
-  gfc_add_expr_to_block (&block, tmp);
+  gfc_add_modify (&block, dest, fold_convert (type, null_pointer_node));
   null_data = gfc_finish_block (&block);

   gfc_init_block (&block);
@@ -7869,9 +7871,7 @@ duplicate_allocatable (tree dest, tree src, tree type, int rank,
   if (!no_malloc)
{
  tmp = gfc_call_malloc (&block, type, size);
- tmp = fold_build2_loc (input_location, MODIFY_EXPR, void_type_node,
-dest, fold_convert (type, tmp));
- gfc_add_expr_to_block (&block, tmp);
+ gfc_add_modify (&block, dest, fold_convert (type, tmp));
}

   if (!no_memcpy)
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index ba71a21..2e6ef2a 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -5093,8 +5103,8 @@ generate_coarray_sym_init (gfc_symbol *sym)
 build_int_cst (integer_type_node, reg_type),
 token, gfc_build_addr_expr (pvoid_type_node, desc),
 null_pointer_node, /* stat.  */
-null_pointer_node, /* errgmsg, errmsg_len.  */
-build_int_cst (integer_type_node, 0));
+null_pointer_node, /* errgmsg.  */
+integer_zero_node); /* errmsg_len.  */
   gfc_add_expr_to_block (&caf_init_block, tmp);
   gfc_add_modify (&caf_init_block, decl, fold_convert (TREE_TYPE (decl),
  gfc_conv_descriptor_data_get (desc)));