Date: Sun, 12 Jan 1997 16:58:08 +0200 (IST) From: Eli Zaretskii To: Leendert Combee cc: djgpp AT delorie DOT com Subject: Re: f2c+djgpp In-Reply-To: <9701121422.AA18628@cambridge.scr.slb.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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