PR69741: Bad error in formal with array scalar loop counters

Harald Anlauf anlauf@gmx.de
Sat Nov 19 14:42:00 GMT 2016


Hi Steve, all,

On 11/19/16 02:18, Steve Kargl wrote:
> The error message is still not clear.  42 is a scalar integer.  Why
> not use the language in the standard?
> 
> C739 (R753) The index-name shall be a named scalar variable of type integer.

I had adjusted the error message to the same appearing in resolve.c
in another place, but you are absolutely right.  The attached patch
takes this into account.  The testcase is derived from the PR.

>>
>> Whoever wants to take this one.
>>
> 
> Ever thought about getting a commit bit and getting more involved
> in gfortran development?  I know 4 or 5 other gentlemen that would
> welcome you with open arms.
> 

Thanks.

During the stabilization phase of gcc-6 I tried to understand more
of the internals of gfortran.  However, most of the time I just got
lost.  I therefore decided to tackle a few simple things.

I don't have the resources to follow the development continuously,
especially when there are changes to ABI or module format.  So it
makes more sense for me to wait till the dust settles.

I'll try to find some time during the current stage 3 to check
whether there are regressions affecting my codes, but no promises.

Harald


2016-11-19  Harald Anlauf  <anlauf@gmx.de>

	PR fortran/69741
	* resolve.c (gfc_resolve_forall): Check for non-scalar index
	variables.

2016-11-19  Harald Anlauf  <anlauf@gmx.de>

	PR fortran/69741
	* gfortran.dg/forall_18.f90: New testcase.

Index: gfortran.dg/forall_18.f90
===================================================================
--- gfortran.dg/forall_18.f90	(revision 0)
+++ gfortran.dg/forall_18.f90	(revision 0)
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! PR 69741 - improve error message for non-scalar FORALL index variables
+!
+subroutine check
+  integer :: ii(2), i, j
+  real :: a(3,2)
+
+  forall (ii(1)=1:3, ii(2)=1:2) ! { dg-error "scalar variable of type
integer" }
+     a(ii(1),ii(2)) = ii(1) * ii(2)
+  end forall
+
+end subroutine check

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-pr69741-resolve.c
Type: text/x-csrc
Size: 667 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20161119/2f2d757c/attachment.bin>


More information about the Fortran mailing list