public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, Fortran, cosmetics] Use convenience functions and constants
@ 2016-11-22 17:56 Andre Vehreschild
  2016-12-03 17:05 ` Steve Kargl
  0 siblings, 1 reply; 4+ messages in thread
From: Andre Vehreschild @ 2016-11-22 17:56 UTC (permalink / raw)
  To: GCC-Patches-ML, GCC-Fortran-ML

[-- Attachment #1: Type: text/plain, Size: 376 bytes --]

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 

[-- Attachment #2: cosmetics_4.clog --]
[-- Type: application/octet-stream, Size: 300 bytes --]

gcc/fortran/ChangeLog:

2016-11-22  Andre Vehreschild  <vehre@gcc.gnu.org>

	* trans-array.c (duplicate_allocatable): Use constants instead of
	creating custom constant tree node of zero or one.  Use gfc_add_modify
	convenience function.
	* trans-decl.c (generate_coarray_sym_init): Use constants.



[-- Attachment #3: cosmetics_4.patch --]
[-- Type: text/x-patch, Size: 2001 bytes --]

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)));

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH, Fortran, cosmetics] Use convenience functions and constants
  2016-11-22 17:56 [PATCH, Fortran, cosmetics] Use convenience functions and constants Andre Vehreschild
@ 2016-12-03 17:05 ` Steve Kargl
  2016-12-03 17:25   ` Andre Vehreschild
  0 siblings, 1 reply; 4+ messages in thread
From: Steve Kargl @ 2016-12-03 17:05 UTC (permalink / raw)
  To: Andre Vehreschild; +Cc: GCC-Patches-ML, GCC-Fortran-ML

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH, Fortran, cosmetics] Use convenience functions and constants
  2016-12-03 17:05 ` Steve Kargl
@ 2016-12-03 17:25   ` Andre Vehreschild
  2016-12-03 18:09     ` Steve Kargl
  0 siblings, 1 reply; 4+ messages in thread
From: Andre Vehreschild @ 2016-12-03 17:25 UTC (permalink / raw)
  To: Steve Kargl; +Cc: GCC-Patches-ML, GCC-Fortran-ML

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 <sgk@troutmask.apl.washington.edu> 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 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH, Fortran, cosmetics] Use convenience functions and constants
  2016-12-03 17:25   ` Andre Vehreschild
@ 2016-12-03 18:09     ` Steve Kargl
  0 siblings, 0 replies; 4+ messages in thread
From: Steve Kargl @ 2016-12-03 18:09 UTC (permalink / raw)
  To: Andre Vehreschild; +Cc: GCC-Patches-ML, GCC-Fortran-ML

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-12-03 18:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-22 17:56 [PATCH, Fortran, cosmetics] Use convenience functions and constants Andre Vehreschild
2016-12-03 17:05 ` Steve Kargl
2016-12-03 17:25   ` Andre Vehreschild
2016-12-03 18:09     ` Steve Kargl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).