This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/31538] result_in_spec_1.f90: Invalid write



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]