This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/31538] result_in_spec_1.f90: Invalid write
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Apr 2007 19:26:11 -0000
- Subject: [Bug fortran/31538] result_in_spec_1.f90: Invalid write
- References: <bug-31538-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from burnus at gcc dot gnu dot org 2007-04-11 20:26 -------
Actually, it turned out that this is an out-of-bounds problem:
character(len(ch)) :: chr(2)
chr = test2 (1)
however, test(1) returns an array of the size (2*1+1)+1 = 4.
gfortran's -fbounds-check message is a bit misleading, though:
Fortran runtime error: Array bound mismatch for dimension 1 of array 'r' (in
file '/home/tob/projects/gcc/gcc/testsuite/gfortran.dg/result_in_spec_1.f90',
at line 22)
I think NAG f95's is better:
Rank 1 of array operand has extent 4 instead of 2
In MYFUNC, line 42 of result_in_spec_1.f90
Line 22 is:
do i = 1, len(r)
where "r" is function result character(len=3),dimension(4). And line 42 is:
chr = test2 (1)
The test case needs to be fixed, the question is whether the bounding error
should be improved too?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31538