c: Fix up pointer types to may_alias structures [PR114493]
[official-gcc.git] / gcc / testsuite / gfortran.dg / pr95446.f90
blob86e1019d7af9aeafc4c092d3ae4405067ea56c55
1 ! { dg-do compile }
2 ! { dg-options "-pedantic-errors" }
4 ! Contributed by Martin Diehl <m.diehl@mpie.de>
6 program elemental_optional
7 implicit none
8 integer :: m(5), r(5)
10 m = 1
12 r = outer()
13 r = outer(m)
15 contains
17 function outer(o) result(l)
18 integer, intent(in), optional :: o(:)
19 integer :: u(5), l(5)
21 l = inner(o,u)
23 end function outer
25 elemental function inner(a,b) result(x)
26 integer, intent(in), optional :: a
27 integer, intent(in) :: b
28 integer :: x
30 if(present(a)) then
31 x = a*b
32 else
33 x = b
34 endif
35 end function inner
37 end program elemental_optional