Re: [Fortran, Patch, Teams, 6/5] Various fixes for F2018 teams support

2025-04-22 Thread Andre Vehreschild
Hi Jerry, hi Paul,

thanks for the review. Committed as gcc-16-79-g6e3b92848b5 (for the 6 of 5
commit) on mainline. 

Thanks again for the fast review.

Regards,
Andre

On Fri, 18 Apr 2025 18:27:03 -0700
Jerry D  wrote:

> On 4/18/25 9:13 AM, Paul Richard Thomas wrote:
> > Hi Andre,
> > 
> > On Thu, 17 Apr 2025 at 14:20, Andre Vehreschild  > > wrote:
> > 
> > Hi Jerry,
> > 
> > thanks for the review and sorry for the long delay. With publishing
> > the team's
> > patches for gfortran, I also created a pull request for
> > OpenCoarrays. There I
> > was asked to add some testcase with more "beef" in it. I.e.
> > something that
> > really makes use of teams and not only smoke tests it. This
> > unfortunately made
> > me discover some issues, that I needed to fix. The attached patch 6/5
> > addresses these issues. Some of them were as easy as not being able
> > to exit out
> > of change team block or an end team with a label not being parsed
> > correctly and
> > not generated in resulting binary. Others were more subtle, like
> > having to
> > create coarray tokens for association in the change team.
> > 
> > The attached patch addresses all these issues and
> > 
> > bootstraps and regtests ok on x86_64-pc-linux-gnu / F41. Ok for
> > mainline?
> > 
> > Btw, do I still merge to master, or am I to wait for the bump to
> > 16th master?
> > 
> > Regards,
> >          Andre
> > 
> > This all looks good to me, except for two tiny nits. It looks as if we 
> > are already on 16-branch :-(
> > 
> > I have been religiously ending ChangeLogs at column 72 since I started 
> > supporting gfortran. If this is still a requirement, I suggest:
> > line 14: s/it is/it's/
> > line 23: carry "are" over to the next line.
> > 
> > OK for mainline and, I would suggest, backporting to 15-branch asap.
> > 
> > Thanks for the patch
> > 
> > Paul
> >   
> 
> Agree, Andre OK for 16, proceed.
> 
> Jerry


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


Re: [patch fortran] PR119836 [15/16 Regression] Elemental intrinsic treated as IMPURE within BLOCK within DO CONCURRENT

2025-04-22 Thread Jerry D

Ping! Can we backport this to 15 please?

Regards,

Jerry

On 4/18/25 6:35 PM, Jerry D wrote:

On 4/18/25 5:48 PM, Jerry D wrote:

I will be committing a fix for this to the 16 mainline tonight.

I am requesting Release Manager approval to push to 15 release branch 
after full testing here.


Regards,

Jerry

See attached diff.

2025-04-18  Steven G. Kargl  

PR fortran/119836
* resolve.cc(check_pure_function, pure_subroutine): Fix checking for
an impure subprogram within a DO CONCURRENT construct.


2025-04-18  Steven G. Kargl  

PR fortran/119836
* gfortran.dg/do_concurrent_all_clauses.f90: Remove invalid
dg-error test.
* gfortran.dg/pr119836_1.f90: New test.
* gfortran.dg/pr119836_2.f90: Ditto.
* gfortran.dg/pr119836_3.f90: Ditto.
* gfortran.dg/pr119836_4.f90: Ditto.


I have committed to 16 and the backport to 15 is ready to go pending RM 
approval.


Best Regards,

Jerry

commit 5927077029d61fdd32531530b9568cf6949fe0dd (HEAD -> gcc15)
Author: Steven G. Kargl 
Date:   Fri Apr 18 18:05:10 2025 -0700

     Fortran: Fix checking for IMPURE in DO CONCURRENT.

     PR fortran/119836

     gcc/fortran/ChangeLog:

     * resolve.cc (check_pure_function): Fix checking for
     an impure subprogram within a DO CONCURRENT construct.
     (pure_subroutine): Ditto.

     gcc/testsuite/ChangeLog:

     * gfortran.dg/do_concurrent_all_clauses.f90: Remove invalid
     dg-error test.
     * gfortran.dg/pr119836_1.f90: New test.
     * gfortran.dg/pr119836_2.f90: New test.
     * gfortran.dg/pr119836_3.f90: New test.
     * gfortran.dg/pr119836_4.f90: New test.

     (cherry picked from commit f9ea46d946887a05d7ecbca5aeeb99fd868f6e70)





[Fortran, Patch, PR119200, v1] Use correct locus while check()ing coarray functions.

2025-04-22 Thread Andre Vehreschild
Hi all,

attached patch fixes an illegal use of gfc_current_locus during the
check()-phase of several coarray functions. Instead gfc_current_intrinsic_where
needs to be used. This error does not crash gfortran reliably. But valgrind
reports an access to uninitialized memory. I therefore do not know how to test
this in the testsuite.

Regtests ok on x86_64-pc-linux-gnu / F41. Ok for mainline?

Regards,
Andre
-- 
Andre Vehreschild * Email: vehre ad gmx dot de 
From 56a5099b9ed307b1c3cd1bfbe2058ef74f43 Mon Sep 17 00:00:00 2001
From: Andre Vehreschild 
Date: Tue, 22 Apr 2025 10:11:52 +0200
Subject: [PATCH] Fortran: Use correct location in check of coarray functions
 [PR119200]

Use gfc_current_intrinsic_where during check(), because
gfc_current_locus is not set to correct location or at all.

	PR fortran/119200

gcc/fortran/ChangeLog:

	* check.cc (gfc_check_lcobound): Use locus from intrinsic_where.
	(gfc_check_image_index): Same.
	(gfc_check_num_images): Same.
	(gfc_check_team_number): Same.
	(gfc_check_this_image): Same.
	(gfc_check_ucobound): Same.
---
 gcc/fortran/check.cc | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc
index 356e0d7f678..91945bea1e3 100644
--- a/gcc/fortran/check.cc
+++ b/gcc/fortran/check.cc
@@ -3835,7 +3835,8 @@ gfc_check_lcobound (gfc_expr *coarray, gfc_expr *dim, gfc_expr *kind)
 {
   if (flag_coarray == GFC_FCOARRAY_NONE)
 {
-  gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
+  gfc_fatal_error ("Coarrays disabled at %L, use %<-fcoarray=%> to enable",
+		   gfc_current_intrinsic_where);
   return false;
 }
 
@@ -6572,7 +6573,8 @@ gfc_check_image_index (gfc_expr *coarray, gfc_expr *sub,
 
   if (flag_coarray == GFC_FCOARRAY_NONE)
 {
-  gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
+  gfc_fatal_error ("Coarrays disabled at %L, use %<-fcoarray=%> to enable",
+		   gfc_current_intrinsic_where);
   return false;
 }
 
@@ -6622,7 +6624,8 @@ gfc_check_num_images (gfc_expr *team_or_team_number)
 {
   if (flag_coarray == GFC_FCOARRAY_NONE)
 {
-  gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
+  gfc_fatal_error ("Coarrays disabled at %L, use %<-fcoarray=%> to enable",
+		   gfc_current_intrinsic_where);
   return false;
 }
 
@@ -6651,7 +6654,8 @@ gfc_check_team_number (gfc_expr *team)
 {
   if (flag_coarray == GFC_FCOARRAY_NONE)
 {
-  gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
+  gfc_fatal_error ("Coarrays disabled at %L, use %<-fcoarray=%> to enable",
+		   gfc_current_intrinsic_where);
   return false;
 }
 
@@ -6668,7 +6672,8 @@ gfc_check_this_image (gfc_actual_arglist *args)
 
   if (flag_coarray == GFC_FCOARRAY_NONE)
 {
-  gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
+  gfc_fatal_error ("Coarrays disabled at %L, use %<-fcoarray=%> to enable",
+		   gfc_current_intrinsic_where);
   return false;
 }
 
@@ -6967,7 +6972,8 @@ gfc_check_ucobound (gfc_expr *coarray, gfc_expr *dim, gfc_expr *kind)
 {
   if (flag_coarray == GFC_FCOARRAY_NONE)
 {
-  gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
+  gfc_fatal_error ("Coarrays disabled at L, use %<-fcoarray=%> to enable",
+		   gfc_current_intrinsic_where);
   return false;
 }
 
-- 
2.49.0



Re: [patch fortran] PR119836 [15/16 Regression] Elemental intrinsic treated as IMPURE within BLOCK within DO CONCURRENT

2025-04-22 Thread Jakub Jelinek
On Fri, Apr 18, 2025 at 05:48:46PM -0700, Jerry D wrote:
> I will be committing a fix for this to the 16 mainline tonight.
> 
> I am requesting Release Manager approval to push to 15 release branch after
> full testing here.
> 
> Regards,
> 
> Jerry
> 
> See attached diff.
> 
> 2025-04-18  Steven G. Kargl  
> 
> PR fortran/119836
> * resolve.cc(check_pure_function, pure_subroutine): Fix checking for
> an impure subprogram within a DO CONCURRENT construct.
> 
> 
> 2025-04-18  Steven G. Kargl  
> 
> PR fortran/119836
> * gfortran.dg/do_concurrent_all_clauses.f90: Remove invalid
> dg-error test.
> * gfortran.dg/pr119836_1.f90: New test.
> * gfortran.dg/pr119836_2.f90: Ditto.
> * gfortran.dg/pr119836_3.f90: Ditto.
> * gfortran.dg/pr119836_4.f90: Ditto.

Ok for 15.1 if you can commit this before RC2 is being made.

Jakub



Re: [Fortran, Patch, PR119200, v1] Use correct locus while check()ing coarray functions.

2025-04-22 Thread Harald Anlauf

Hi Andre,

Am 22.04.25 um 15:07 schrieb Andre Vehreschild:

Hi all,

attached patch fixes an illegal use of gfc_current_locus during the
check()-phase of several coarray functions. Instead gfc_current_intrinsic_where
needs to be used.


this is bordering on the obvious and thus OK, except for:

@@ -6967,7 +6972,8 @@ gfc_check_ucobound (gfc_expr *coarray, gfc_expr 
*dim, gfc_expr *kind)

 {
   if (flag_coarray == GFC_FCOARRAY_NONE)
 {
-  gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to 
enable");
+  gfc_fatal_error ("Coarrays disabled at L, use %<-fcoarray=%> to 
enable",

+  gfc_current_intrinsic_where);
   return false;
 }

A percent is missing.  It should read "%L", not "L".


This error does not crash gfortran reliably. But valgrind
reports an access to uninitialized memory. I therefore do not know how to test
this in the testsuite.


I don't know a reasonable way to test this either.  There is one
existing test with dg-error "Coarrays disabled..., but the issue
addressed here might show up only in an instrumented compiler
(ASAN or UBSAN?).  And since each message here is emitted by
gfc_fatal_error(), one could only test one case per testcase.
(IMHO testing this would be insane.)


Regtests ok on x86_64-pc-linux-gnu / F41. Ok for mainline?


Yes, this is OK.  Thanks for the patch!

Harald


Regards,
Andre