This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/50069] FORALL fails on a character array
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 17 Aug 2011 08:44:30 +0000
- Subject: [Bug fortran/50069] FORALL fails on a character array
- Auto-submitted: auto-generated
- References: <bug-50069-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50069
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-08-17 08:44:30 UTC ---
(In reply to comment #2)
> Draft patch:
This patch fails for gfortran.dg/forall_12.f90 test (of PR31217 and PR33811):
character(LEN=12) :: a(2) = "123456789012"
forall (i = 3:10) a(:)(i:i+2) = a(:)(i-2:i)
The result with the patch is
12@+@+
instead of
121234567890
* * *
For the test of comment 0, gfortran (unpatched) produces:
atmp.1.offset = 0;
and accesses
atmp.1.data)[atmp.1.offset + 1]
While for the now failing test case forall_12.f90, gfortran (unpatched)
produces also
atmp.1.offset = 0;
but uses
D.1578 = atmp.1.offset;
D.1577 = ... atmp.1.data;
&(*D.1577)[S.5 + D.1578]
where S.5 is the loop variable, which runs from 0 to 1.
Thus, the actual problem seems to be that "a(1)" is translated into
"a[1+offset]" instead of "a[0+offset]".