PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / module_procedure_1.f90
blob8fadb035378b6295d3b2a5ddf87a048197cdcc83
1 ! { dg-do run }
2 ! Modified program from http://groups.google.com/group/\
3 ! comp.lang.fortran/browse_frm/thread/423e4392dc965ab7#
5 module myoperator
6 contains
7 function dadd(arg1,arg2)
8 integer ::dadd(2)
9 integer, intent(in) :: arg1(2), arg2(2)
10 dadd(1)=arg1(1)+arg2(1)
11 dadd(2)=arg1(2)+arg2(2)
12 end function dadd
13 end module myoperator
15 program test_interface
17 use myoperator
19 implicit none
21 interface operator (.myadd.)
22 module procedure dadd
23 end interface
25 integer input1(2), input2(2), mysum(2)
27 input1 = (/0,1/)
28 input2 = (/3,3/)
29 mysum = input1 .myadd. input2
30 if (mysum(1) /= 3 .and. mysum(2) /= 4) STOP 1
32 call test_sub(input1, input2)
34 end program test_interface
36 subroutine test_sub(input1, input2)
38 use myoperator
40 implicit none
42 interface operator (.myadd.)
43 module procedure dadd
44 end interface
46 integer, intent(in) :: input1(2), input2(2)
47 integer mysum(2)
49 mysum = input1 .myadd. input2
50 if (mysum(1) /= 3 .and. mysum(2) /= 4) STOP 2
52 end subroutine test_sub