[Bug fortran/69741] New: forall array scalar loop counters
nickpapior at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Feb 10 08:41:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69741
Bug ID: 69741
Summary: forall array scalar loop counters
Product: gcc
Version: 5.2.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: nickpapior at gmail dot com
Target Milestone: ---
In forall statements it may be easier in some cases to use array elements as
loop counters.
I can only find in the specification that an integer scalar is required as a
loop counter and hence I thought that i(1) may be a valid loop counter.
1. If this is allowed then there is a bug.
2. If this is not allowed then the error message is vague and unclear.
Compiling the following program results in an error:
```
subroutine check
integer :: ii(2)
real :: a(3,2)
forall (ii(1)=1:3 , ii(2)=1:2)
a(ii(1),ii(2)) = ii(1) * ii(2)
end forall
end subroutine check
```
With the error being:
```
test.f90:5:21:
forall (ii(1)=1:3 , ii(2)=1:2)
1
Error: An outer FORALL construct already has an index with this name (1)
test.f90:6:5:
a(ii(1),ii(2)) = ii(1) * ii(2)
1
Warning: The FORALL with index ‘ii’ is not used on the left side of the
assignment at (1) and so might cause multiple assignment to this object
test.f90:6:5: Warning: The FORALL with index ‘ii’ is not used on the left side
of the assignment at (1) and so might cause multiple assignment to this object
```
This error message does not reflect the actual error if array elements are not
allowed as loop counters.
PS: Compiler info:
gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/opt/generic/gcc/5.2.0/libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix /opt/generic/gcc/5.2.0
--with-gmp=/opt/generic/gmp/6.0.0a --with-mpfr=/opt/generic/mpfr/3.1.3
--with-mpc=/opt/generic/mpc/1.0.3 --with-isl=/opt/generic/isl/0.15 --enable-lto
--enable-threads --enable-stage1-languages=c,c++,fortran,go,objc,obj-c++
--with-multilib-list=m64
Thread model: posix
gcc version 5.2.0 (GCC)
More information about the Gcc-bugs
mailing list