[Bug fortran/31538] result_in_spec_1.f90: Invalid write
burnus at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Apr 11 19:26:00 GMT 2007
------- 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
More information about the Gcc-bugs
mailing list