[patch, fortran] Fix PR 30814, bounds checking for pack

Tobias Burnus burnus@net-b.de
Fri Jul 20 22:05:00 GMT 2007


:REVIEWMAIL:

Thomas Koenig wrote:
>> OK for trunk if it passes?
>>     
> Regression-test was OK.
>   
The patch is ok except of two things.

First, I think one should add to the Fortran documentation of
-fbounds-check something like:
"Some checking is only effective if this option is used for the
compilation of the Fortran main program."

Secondly, the error message:

+         /* We come here because of range checking.  */
+         if (total != ret->dim[0].ubound + 1 - ret->dim[0].lbound)
+           runtime_error ("Different array shape in return value of"
+                          " PACK intrinsic");


I think one should print additionally "total" and the size of ret as
this helps the user to fix the problem.
Additionally, - personal taste - I like "extend", "size" and "length"
more than "shape" which I find misleading for a rank 1 array.

Some wording ideas from other compilers (which detect the problem
already at compile time):

NAG f95:
  Error: a.f90, line 3: Different vector lengths (19 and 30)
ifort:
  Error: a.f90, line 3: The shapes of the array expressions do not
conform.   [NEIGHBRS]
sunf95:
  ERROR: The left and right hand sides of this array syntax assignment
must be conformable arrays.
openf95:
  The left and right hand sides of this array syntax assignment must be
conformable arrays.

And for the modified program NAG f95 prints at runtime:
  Rank 1 of array operand has extent 30 instead of 19

Tobias



More information about the Fortran mailing list