summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/intrinsic_sign_1.f90
blob: 03addde78c402c429c7635c72b2b4d4bffc12d44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
! { dg-do run }
! At one point, SIGN() evaluated its first argument twice.
! Contributed by Brooks Moses <brooks.moses@codesourcery.com>
program sign1
  integer :: i
  i = 1
  if (sign(foo(i), 1) /= 1) call abort
  i = 1
  if (sign(foo(i), -1) /= -1) call abort
contains
  integer function foo(i)
    integer :: i
    foo = i
    i = i + 1
  end function
end