OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [module_procedure_1.f90] - Blame information for rev 694

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do run }
2
! Modified program from http://groups.google.com/group/\
3
! comp.lang.fortran/browse_frm/thread/423e4392dc965ab7#
4
!
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
14
 
15
program test_interface
16
 
17
   use myoperator
18
 
19
   implicit none
20
 
21
   interface operator (.myadd.)
22
      module procedure dadd
23
   end interface
24
 
25
   integer input1(2), input2(2), mysum(2)
26
 
27
   input1 = (/0,1/)
28
   input2 = (/3,3/)
29
   mysum = input1 .myadd. input2
30
   if (mysum(1) /= 3 .and. mysum(2) /= 4) call abort
31
 
32
   call test_sub(input1, input2)
33
 
34
end program test_interface
35
 
36
subroutine test_sub(input1, input2)
37
 
38
   use myoperator
39
 
40
   implicit none
41
 
42
   interface operator (.myadd.)
43
      module procedure dadd
44
   end interface
45
 
46
   integer, intent(in) :: input1(2), input2(2)
47
   integer mysum(2)
48
 
49
   mysum = input1 .myadd. input2
50
   if (mysum(1) /= 3 .and. mysum(2) /= 4) call abort
51
 
52
end subroutine test_sub
53
! { dg-final { cleanup-modules "myoperator" } }

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.