Jerry D wrote:
On 11/3/25 12:47 PM, Tobias Burnus wrote:
Jerry D wrote:
Regression tested on x86_64.
* resolve.cc (check_default_none_expr): Do not allow an
iterator in a locality spec.
Shouldn't be there a testcase for this? I see one for the other
issue, namely ...
The test case I provided fails to compile before the patch so I
thought it was sufficient since the new logic avoids rejecting valid.
At least grepping showed no testcase for this message
at all; hence, I think it makes sense to have one.
Therefore, I committed the attach patch.
Thanks,
Tobias
commit 95cabf531c5d65dfb7d0ccbf2dd0b4ec6825489e
Author: Tobias Burnus <[email protected]>
Date: Tue Nov 4 10:23:31 2025 +0100
gfortran.dg/pr122513-2.f90: New test [PR122513]
This test is from PR122513; even though the actual error message was
already added in GCC 15, there was no testcase for the diagnostic type
Index variable 'i' at (1) cannot be specified in a locality-spec
Thus, this commit adds one.
gcc/testsuite/ChangeLog:
PR fortran/122513
* gfortran.dg/pr122513-2.f90: New test.
---
gcc/testsuite/gfortran.dg/pr122513-2.f90 | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/gcc/testsuite/gfortran.dg/pr122513-2.f90 b/gcc/testsuite/gfortran.dg/pr122513-2.f90
new file mode 100644
index 00000000000..3f6c5c4fcab
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr122513-2.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+
+! PR fortran/122513
+
+! The error is not really new but seems to be untested
+! before. The example is from the mentioned PR.
+
+program test
+ implicit none
+ integer :: i
+ do concurrent (i=1:2) default (none) local(i) ! { dg-error "Index variable 'i' at .1. cannot be specified in a locality-spec" }
+ block
+ integer, dimension(2,3), parameter :: &
+ ii = reshape((/ 1,2,3,4,5,6 /), (/2, 3/))
+ print*,ii(i,:)
+ end block
+ end do
+end program test