1! { dg-do compile }
2! { dg-options "-std=f2003" }
3!
4! NULL() actual argument to non-pointer dummies
5!
6
7call f(null()) ! { dg-error "Fortran 2008: Null pointer at .1. to non-pointer dummy" }
8call g(null()) ! { dg-error "Unexpected NULL.. intrinsic at .1. to dummy" }
9call h(null()) ! { dg-error "Unexpected NULL.. intrinsic at .1. to dummy" }
10contains
11subroutine f(x)
12  integer, optional  :: x
13end subroutine f
14subroutine g(x)
15  integer, optional, allocatable  :: x
16end subroutine g
17subroutine h(x)
18  integer :: x
19end subroutine h
20end
21