This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]