This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

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


: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


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