1! { dg-do compile }
2! Bug 45794 - ICE: Segmentation fault in gfc_conv_procedure_call
3subroutine foo (vector, mask)
4  real :: vector(:)
5  logical, optional :: mask(:)
6  integer :: loc(1)
7  if (present(mask)) then
8    loc = maxloc(vector, mask)
9  end if
10end subroutine
11