Array reference at (1) is out of bounds
Richard E Maine
Richard.Maine@nasa.gov
Fri Jul 14 20:40:00 GMT 2006
On Jul 14, 2006, at 11:00 AM, Jack Howarth wrote:
> I noticed that the stock fftpack generates some warnings of
> the form..
>
> cd fftpack; gfortran -c -O3 -g rffti1.f
> In file rffti1.f:24
>
> IFAC(3) = 2
> 1
> Warning: Array reference at (1) is out of bounds
I've run into that on other compilers. In fact, I've seen compilers
where it was a fatal error - not just a warning. You could not
successfully compile the code as is. Do note that gfortran is giving
only a warning. A "warning" usually means just what it sounds like in
English. The easiest fix is just to ignore it; presumably it compiled
correctly. That might not be the best fix in all circumstances, but
it is sure the easiest one. If you don;t like that one, you could
probably turn off warning messages. Please, please do *NOT* encourage
deletion of the warning from gfortran. The code deserves a warning. I
hate it when compilers swallow nonstandard code without even giving a
hint about something being unusual.
Fftpack is actually violating the standard in this regard. Although
the dimension 1 trick has a long history, it has never actually been
standard conforming. There just wasn't a proper way to do the job in
f66, so people used that trick because it happened to work even
though it violated the standard. As pointed out by others, the proper
fix is to change the 1 dimensions to *. I don't know why fftpack
wasn't written that way in the first place. The old 1 trick became
unnecessary with f77, 25 years ago.
--
Richard Maine | Good judgment comes from experience;
Richard.Maine@nasa.gov | experience comes from bad judgment.
| -- Mark Twain
More information about the Fortran
mailing list