This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/31821] character pointer => target(range) should detect if lengths don't match
- From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 12 Dec 2010 14:09:17 +0000
- Subject: [Bug fortran/31821] character pointer => target(range) should detect if lengths don't match
- Auto-submitted: auto-generated
- References: <bug-31821-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31821
--- Comment #8 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-12-12 14:09:12 UTC ---
The patch in comment#7 causes a regression in
program gfcbug33
character(12) :: a(2)
a(1) = "abcdefghijkl"
a(2) = "mnopqrstuvwx"
call foo ((a(2:1:-1)(6:)))
contains
subroutine foo (chr)
character(7) :: chr(:)
print *,'X',chr(1),'Y'
print *,'A',chr(2),'B'
if (chr(1)//chr(2) .ne. "rstuvwxfghijkl") call abort ()
end subroutine foo
end program gfcbug33
ig25@linux-fd1f:~/Krempel/Char> gfortran short_1.f90
ig25@linux-fd1f:~/Krempel/Char> ./a.out
XrstuvwxY
A%ï2ïfgB
Abgebrochen
which is a shortened version of actual_array_substr_1.f90.
The part of the patch
- if (substring)
- primary->ts.u.cl = NULL;
-
opens a can of worms of wrong-code and rejects-valid bugs...