summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/min_max_optional_5.f90
blob: ae3344f790fc5a07fdaf072283fade185751cfe8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
! More tests for MIN/MAX with optional arguments
! PR33095
!
! { dg-do run }
  if (m1(3,4) /= 4) call abort
  if (m1(3) /= 3) call abort
  if (m1() /= 2) call abort

  if (m1(3,4) /= 4) call abort
  if (m1(3) /= 3) call abort
contains
  integer function m1(a1,a2)
    integer, optional, intent(in) :: a1, a2
    m1 = max(1, 2, a1, a2)
  end function m1

  integer function m2(a1,a2)
    integer, optional, intent(in) :: a1, a2
    m2 = max(1, a1, 2, a2)
  end function m2
end