This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [FORTRAN PATCH]: Improved integer SIGN intrinsic (& bug-fix)
On Fri, Jan 19, 2007 at 05:36:43PM -0800, Brooks Moses wrote:
> Brooks Moses wrote:
> >Here, try this:
> >
> >! { dg-do run }
> >! At one point, SIGN() evaluated its first argument twice.
> >program sign1
> > integer :: i = 1
> > if (sign(foo(i), 1) /= 1) call abort
>
> Er, right. This also needs an "i = 1" line inserted here.
>
> > if (sign(foo(i), -1) /= -1) call abort
> >contains
> > integer function foo(i)
> > integer :: i
or a save attribute here.
> > foo = i
> > i = i + 1
> > end function
> >end
--
Steve