Re: [Ping^2, Patch, Fortran] PR98301 Re: RANDOM_INIT() and coarray Fortran

2021-05-23 Thread Martin Liška

On 5/23/21 1:59 PM, Andre Vehreschild wrote:

Hi Martin,

thanks for pointing that out. I haven't committed for quite some time now and
could not find on the webpage how this works nowadays. I was thinking that the
special gcc-git-command should have added the Changelog entries automagically
and immediately. That they are added by a daily bump is new to me. Thanks for
giving me more insight.


Sure, I'm fully aware that occasional committers are not aware of that.



So do I need to revert the commit c4771b3438a8cd9afcef1762957b763f8df3fa6e to
fix the Changelogs or how do we proceed from here?


I've just done that.


Is there a webpage which describes the current state-of-art of committing to
gcc for folks that do not follow every discussion on the mailing lists?


It's documented here:
https://gcc.gnu.org/codingconventions.html#ChangeLogs

But it's far from a good location. I'm going to improve it.

Cheers,
Martin



Thanks for your help,
Andre
On Sat, 22 May 2021 19:58:57 +0200
Martin Liška  wrote:


On 5/22/21 1:39 PM, Andre Vehreschild via Gcc-patches wrote:

Hi Steve and Jerry,

thanks for the ok'ing.

Committed as https://gcc.gnu.org/g:26ca6dbda23bc6dfab96ce07afa70ebacedfaf9c
and https://gcc.gnu.org/g:c4771b3438a8cd9afcef1762957b763f8df3fa6e (for the
missing changelog entries).


Hello.

About the missing changelog entries. The will be added automatically by Daily
bump. You can check it with:
./contrib/gcc-changelog/git_check_commit.py
26ca6dbda23bc6dfab96ce07afa70ebacedfaf9c -p

What's missing for you so that you pushed
c4771b3438a8cd9afcef1762957b763f8df3fa6e?

Thanks,
Martin



- Andre

On Fri, 21 May 2021 19:38:00 -0700
Jerry D  wrote:
   

yes, please commit

On 5/21/21 8:08 AM, Steve Kargl via Fortran wrote:

On Fri, May 21, 2021 at 10:09:02AM +0200, Andre Vehreschild wrote:

Ping, ping!

Please find attached a rebased version of the patch for the RANDOM_INIT
issue with coarray Fortran. Nothing changed to the previous version, just
rebased to current master.

Regtested fine on x86_64-linux/f33. Ok for trunk?
  

I think you've down your due diligence with 2 pings.
I would commit.
  
  



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









Re: [Ping^2, Patch, Fortran] PR98301 Re: RANDOM_INIT() and coarray Fortran

2021-05-23 Thread Andre Vehreschild via Gcc-patches
Hi Martin,

thanks for pointing that out. I haven't committed for quite some time now and
could not find on the webpage how this works nowadays. I was thinking that the
special gcc-git-command should have added the Changelog entries automagically
and immediately. That they are added by a daily bump is new to me. Thanks for
giving me more insight.

So do I need to revert the commit c4771b3438a8cd9afcef1762957b763f8df3fa6e to
fix the Changelogs or how do we proceed from here? 

Is there a webpage which describes the current state-of-art of committing to
gcc for folks that do not follow every discussion on the mailing lists?

Thanks for your help,
Andre
On Sat, 22 May 2021 19:58:57 +0200
Martin Liška  wrote:

> On 5/22/21 1:39 PM, Andre Vehreschild via Gcc-patches wrote:
> > Hi Steve and Jerry,
> > 
> > thanks for the ok'ing.
> > 
> > Committed as https://gcc.gnu.org/g:26ca6dbda23bc6dfab96ce07afa70ebacedfaf9c
> > and https://gcc.gnu.org/g:c4771b3438a8cd9afcef1762957b763f8df3fa6e (for the
> > missing changelog entries).  
> 
> Hello.
> 
> About the missing changelog entries. The will be added automatically by Daily
> bump. You can check it with:
> ./contrib/gcc-changelog/git_check_commit.py
> 26ca6dbda23bc6dfab96ce07afa70ebacedfaf9c -p
> 
> What's missing for you so that you pushed
> c4771b3438a8cd9afcef1762957b763f8df3fa6e?
> 
> Thanks,
> Martin
> 
> > 
> > - Andre
> > 
> > On Fri, 21 May 2021 19:38:00 -0700
> > Jerry D  wrote:
> >   
> >> yes, please commit
> >>
> >> On 5/21/21 8:08 AM, Steve Kargl via Fortran wrote:  
> >>> On Fri, May 21, 2021 at 10:09:02AM +0200, Andre Vehreschild wrote:  
>  Ping, ping!
> 
>  Please find attached a rebased version of the patch for the RANDOM_INIT
>  issue with coarray Fortran. Nothing changed to the previous version, just
>  rebased to current master.
> 
>  Regtested fine on x86_64-linux/f33. Ok for trunk?
>   
> >>> I think you've down your due diligence with 2 pings.
> >>> I would commit.
> >>>  
> >>  
> > 
> > 
> > --
> > Andre Vehreschild * Email: vehre ad gmx dot de
> >   
> 


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


Re: [Ping^2, Patch, Fortran] PR98301 Re: RANDOM_INIT() and coarray Fortran

2021-05-22 Thread Martin Liška

On 5/22/21 1:39 PM, Andre Vehreschild via Gcc-patches wrote:

Hi Steve and Jerry,

thanks for the ok'ing.

Committed as https://gcc.gnu.org/g:26ca6dbda23bc6dfab96ce07afa70ebacedfaf9c
and https://gcc.gnu.org/g:c4771b3438a8cd9afcef1762957b763f8df3fa6e (for the
missing changelog entries).


Hello.

About the missing changelog entries. The will be added automatically by Daily 
bump.
You can check it with:
./contrib/gcc-changelog/git_check_commit.py 
26ca6dbda23bc6dfab96ce07afa70ebacedfaf9c -p

What's missing for you so that you pushed 
c4771b3438a8cd9afcef1762957b763f8df3fa6e?

Thanks,
Martin



- Andre

On Fri, 21 May 2021 19:38:00 -0700
Jerry D  wrote:


yes, please commit

On 5/21/21 8:08 AM, Steve Kargl via Fortran wrote:

On Fri, May 21, 2021 at 10:09:02AM +0200, Andre Vehreschild wrote:

Ping, ping!

Please find attached a rebased version of the patch for the RANDOM_INIT
issue with coarray Fortran. Nothing changed to the previous version, just
rebased to current master.

Regtested fine on x86_64-linux/f33. Ok for trunk?


I think you've down your due diligence with 2 pings.
I would commit.






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





Re: [Ping^2, Patch, Fortran] PR98301 Re: RANDOM_INIT() and coarray Fortran

2021-05-22 Thread Andre Vehreschild via Gcc-patches
Hi Steve and Jerry,

thanks for the ok'ing.

Committed as https://gcc.gnu.org/g:26ca6dbda23bc6dfab96ce07afa70ebacedfaf9c
and https://gcc.gnu.org/g:c4771b3438a8cd9afcef1762957b763f8df3fa6e (for the
missing changelog entries).

- Andre

On Fri, 21 May 2021 19:38:00 -0700
Jerry D  wrote:

> yes, please commit
>
> On 5/21/21 8:08 AM, Steve Kargl via Fortran wrote:
> > On Fri, May 21, 2021 at 10:09:02AM +0200, Andre Vehreschild wrote:
> >> Ping, ping!
> >>
> >> Please find attached a rebased version of the patch for the RANDOM_INIT
> >> issue with coarray Fortran. Nothing changed to the previous version, just
> >> rebased to current master.
> >>
> >> Regtested fine on x86_64-linux/f33. Ok for trunk?
> >>
> > I think you've down your due diligence with 2 pings.
> > I would commit.
> >
>


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


Re: [Ping^2, Patch, Fortran] PR98301 Re: RANDOM_INIT() and coarray Fortran

2021-05-21 Thread Jerry D via Gcc-patches

yes, please commit

On 5/21/21 8:08 AM, Steve Kargl via Fortran wrote:

On Fri, May 21, 2021 at 10:09:02AM +0200, Andre Vehreschild wrote:

Ping, ping!

Please find attached a rebased version of the patch for the RANDOM_INIT issue
with coarray Fortran. Nothing changed to the previous version, just rebased to
current master.

Regtested fine on x86_64-linux/f33. Ok for trunk?


I think you've down your due diligence with 2 pings.
I would commit.





Re: [Ping^2, Patch, Fortran] PR98301 Re: RANDOM_INIT() and coarray Fortran

2021-05-21 Thread Steve Kargl via Gcc-patches
On Fri, May 21, 2021 at 10:09:02AM +0200, Andre Vehreschild wrote:
> Ping, ping!
> 
> Please find attached a rebased version of the patch for the RANDOM_INIT issue
> with coarray Fortran. Nothing changed to the previous version, just rebased to
> current master.
> 
> Regtested fine on x86_64-linux/f33. Ok for trunk?
> 

I think you've down your due diligence with 2 pings.
I would commit.

-- 
steve


Re: [Ping^2, Patch, Fortran] PR98301 Re: RANDOM_INIT() and coarray Fortran

2021-05-21 Thread Andre Vehreschild via Gcc-patches
Ping, ping!

Please find attached a rebased version of the patch for the RANDOM_INIT issue
with coarray Fortran. Nothing changed to the previous version, just rebased to
current master.

Regtested fine on x86_64-linux/f33. Ok for trunk?

- Andre

On Mon, 3 May 2021 08:20:36 -0700
Steve Kargl  wrote:

> On Mon, May 03, 2021 at 11:21:10AM +0200, Andre Vehreschild wrote:
> > Ping!
> >
> > Ok for trunk?
> >
> > I have looked at other patches, but none was patching any location I have
> > worked on previously. Therefore I can't return the favor of reviewing any
> > currently open patches and have to ask for volunteers here.
> >
> > - Andre
> >
>
> I doubt I'm allowed to approve a patch, where I wrote a portion
> of it.  However, if no one else steps forward in the next day
> or two, then I think you should commit.
>


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

PR fortran/98301 - random_init() is broken

Correct implementation of random_init() when -fcoarray=lib is given.

gcc/fortran/ChangeLog:

	PR fortran/98301
	* trans-decl.c (gfc_build_builtin_function_decls): Move decl.
	* trans-intrinsic.c (conv_intrinsic_random_init): Use bool for
	lib-call of caf_random_init instead of logical (4-byte).
	* trans.h: Add tree var for random_init.

libgfortran/ChangeLog:

	PR fortran/98301
	* caf/libcaf.h (_gfortran_caf_random_init): New function.
	* caf/single.c (_gfortran_caf_random_init): New function.
	* gfortran.map: Added fndecl.
	* intrinsics/random_init.f90: Implement random_init.

diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 406b4aeb1d4..c32bd05bb1b 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -170,6 +170,7 @@ tree gfor_fndecl_co_min;
 tree gfor_fndecl_co_reduce;
 tree gfor_fndecl_co_sum;
 tree gfor_fndecl_caf_is_present;
+tree gfor_fndecl_caf_random_init;


 /* Math functions.  Many other math functions are handled in
@@ -233,7 +234,7 @@ tree gfor_fndecl_cgemm;
 tree gfor_fndecl_zgemm;

 /* RANDOM_INIT function.  */
-tree gfor_fndecl_random_init;
+tree gfor_fndecl_random_init;  /* libgfortran, 1 image only.  */

 static void
 gfc_add_decl_to_parent_function (tree decl)
@@ -3516,6 +3517,8 @@ gfc_build_intrinsic_function_decls (void)
 	void_type_node, 3, gfc_logical4_type_node, gfc_logical4_type_node,
 	gfc_int4_type_node);

+ // gfor_fndecl_caf_rand_init is defined in the lib-coarray section below.
+
   gfor_fndecl_sc_kind = gfc_build_library_function_decl_with_spec (
 	get_identifier (PREFIX("selected_char_kind")), ". . R ",
 	gfc_int4_type_node, 2, gfc_charlen_type_node, pchar_type_node);
@@ -4081,6 +4084,10 @@ gfc_build_builtin_function_decls (void)
 	get_identifier (PREFIX("caf_is_present")), ". r . r ",
 	integer_type_node, 3, pvoid_type_node, integer_type_node,
 	pvoid_type_node);
+
+  gfor_fndecl_caf_random_init = gfc_build_library_function_decl (
+	get_identifier (PREFIX("caf_random_init")),
+	void_type_node, 2, logical_type_node, logical_type_node);
 }

   gfc_build_intrinsic_function_decls ();
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 4d7451479d3..db9248c0043 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -3827,38 +3827,43 @@ conv_intrinsic_random_init (gfc_code *code)
 {
   stmtblock_t block;
   gfc_se se;
-  tree arg1, arg2, arg3, tmp;
-  tree logical4_type_node = gfc_get_logical_type (4);
+  tree arg1, arg2, tmp;
+  /* On none coarray == lib compiles use LOGICAL(4) else regular LOGICAL.  */
+  tree used_bool_type_node = flag_coarray == GFC_FCOARRAY_LIB
+			 ? logical_type_node
+			 : gfc_get_logical_type (4);

   /* Make the function call.  */
   gfc_init_block ();
   gfc_init_se (, NULL);

-  /* Convert REPEATABLE to a LOGICAL(4) entity.  */
+  /* Convert REPEATABLE to the desired LOGICAL entity.  */
   gfc_conv_expr (, code->ext.actual->expr);
   gfc_add_block_to_block (, );
-  arg1 = fold_convert (logical4_type_node, gfc_evaluate_now (se.expr, ));
+  arg1 = fold_convert (used_bool_type_node, gfc_evaluate_now (se.expr, ));
   gfc_add_block_to_block (, );

-  /* Convert IMAGE_DISTINCT to a LOGICAL(4) entity.  */
+  /* Convert IMAGE_DISTINCT to the desired LOGICAL entity.  */
   gfc_conv_expr (, code->ext.actual->next->expr);
   gfc_add_block_to_block (, );
-  arg2 = fold_convert (logical4_type_node, gfc_evaluate_now (se.expr, ));
+  arg2 = fold_convert (used_bool_type_node, gfc_evaluate_now (se.expr, ));
   gfc_add_block_to_block (, );

-  /* Create the hidden argument.  For non-coarray codes and -fcoarray=single,
- simply set this to 0.  For -fcoarray=lib, generate a call to
- THIS_IMAGE() without arguments.  */
-  arg3 = build_int_cst (gfc_get_int_type (4), 0);
   if (flag_coarray == GFC_FCOARRAY_LIB)
 {
-  arg3 = build_call_expr_loc (input_location, gfor_fndecl_caf_this_image,
-  1, arg3);
-  se.expr = fold_convert (gfc_get_int_type (4), arg3);
+  tmp = build_call_expr_loc (input_location,