option to check that arguments to PACK conform?

Tobias Burnus burnus@net-b.de
Sat Nov 11 21:43:00 GMT 2006


Hi,

> Paul Thomas wrote:
>>> Are you proposing that in the presence of checking that
>>> the frontend should emit a new function such that
>>>    x = reshape(y,z)
>>> becomes
>>>   check_bounds(x, y, z)
>>>   x = reshape(y,z)
>> Yes; using tree-ssa to accomplish it. 
You could consider instead of creating a version with asprintf as in
trans-array.c to call a library function.
That way we could improve the error message output (cf. PR28494):

Currently:
Fortran runtime error: Array reference out of bounds for array 'r',
upper bound of dimension 1 exceeded (in file 'array2.f90', at line 4)

With a library function the following is possible:
Fortran runtime error: Array reference out of bounds. Subscript 1 of
array 'r' (value 5) exceeds upper bound of 4 (in file 'array2.f90', at
line 4)"

When extracting the name of the array for the error message consider
also derived types:
The current trans-array.c prints for 'i' exceeding the bounds: 'V'
rather than 'array' for
   V(1)%array(i)
The best output would be of cause something like 'v%array'. (PR29800)

Tobias



More information about the Fortran mailing list