www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/12/10:32:43

Date: Sun, 12 Jan 1997 16:58:08 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Leendert Combee <combee AT cambridge DOT scr DOT slb DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: f2c+djgpp
In-Reply-To: <9701121422.AA18628@cambridge.scr.slb.com>
Message-ID: <Pine.SUN.3.91.970112165532.7675j-100000@is>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019