Mail Archives: djgpp/1997/01/12/10:32:43
On Sun, 12 Jan 1997, Leendert Combee wrote:
> integer n,i
> real a(n)
> do i = 1, n
> a(i) = ....
> end do
> return
> end
>
> This gets translated into a few lines of c-code, the crucial bit being:
>
> /* Parameter adjustments */
> --a;
>
> (the reason being that a[1] is now really the first element (index 0) of the
> original array). THE PROBLEM IS THAT POINTER a IS **NEVER** RESET: ++a
> So that if test is called twice, the pointer a is decreased *again*.
Are you sure f2c supports such DO loops? They are NOT ANSI Fortran. Try
this instead and see if f2c handles it correctly:
do 10 i = 1, n
a(i) = ....
10 continue
- Raw text -