Bug 28494 - Unclear run time error message
Summary: Unclear run time error message
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.2.0
: P3 enhancement
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2006-07-26 16:18 UTC by Erik Schnetter
Modified: 2007-08-14 13:42 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-02-01 14:18:47


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Schnetter 2006-07-26 16:18:39 UTC
I received the run time error message "upper bound of dimension 1 exceeded".  I initially thought that I had an array with an upper bound of 1, and that the array index was larger than that.  I now think that the error message tells me that I have a rank-2 array, and that the upper bound of the first rank was exceeded.

The error message could be improved to read "rank 1" or "index 1" instead.
Comment 1 Andrew Pinski 2006-07-26 16:22:40 UTC
"dimension 1" means to me, the first dimension.  I don't see why it was not hard to understand, in fact I did not read the rest of your message until I already said to myself this was the first dimension.
Comment 2 tobias.burnus 2006-09-20 08:27:37 UTC
I looked what other are writing:
----------------
gfortran:
Fortran runtime error: Array reference out of bounds for array 'r', upper bound of dimension 1 exceeded (in file 'array2.f90', at line 4)

NAG f95:
Subscript 1 of R (value 5) is out of range (1:4)

Intel Fortran Compiler ifort:
forrtl: severe (408): fort: (2): Subscript #1 of the array R has value 5 which is greater than the upper bound of 4

Sun f95:
 ******  FORTRAN RUN-TIME SYSTEM  ******
Subscript out of range. Location:  line 4 column 5 of 'array2.f90'
Subscript number 1 has value 5 in array 'R'
----------------

Personal favourite would be:

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

The place to change would be trans-array.c. I looked at it, but I fail to extract a asprintf-able number from the "tree"s index etc.
Comment 3 Tobias Burnus 2006-11-10 22:38:04 UTC
As FX wrote in an email, a more-detailed error message can not be given with the current method: at present the error string is constructed at compile time via asprintf, but then the extend of the array might not be known - and the current value neither.
One needs therefore to replace the current code by something which calls the library.
Comment 4 Francois-Xavier Coudert 2007-08-14 13:42:44 UTC
(In reply to comment #3)
> One needs therefore to replace the current code by something which calls the
> library.

This was done, and the current error message was corrected.