OSDN Git Service

* MAINTAINERS (mt port): Remove.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / integer_exponentiation_5.F90
1 ! { dg-do run }
2 ! { dg-options "-fno-range-check" }
3 module mod_check
4   implicit none
5
6   interface check
7     module procedure check_i8
8     module procedure check_i4
9     module procedure check_r8
10     module procedure check_r4
11     module procedure check_c8
12     module procedure check_c4
13   end interface check
14
15 contains
16
17   subroutine check_i8 (a, b)
18     integer(kind=8), intent(in) :: a, b
19     if (a /= b) call abort()
20   end subroutine check_i8
21
22   subroutine check_i4 (a, b)
23     integer(kind=4), intent(in) :: a, b
24     if (a /= b) call abort()
25   end subroutine check_i4
26
27   subroutine check_r8 (a, b)
28     real(kind=8), intent(in) :: a, b
29     if (a /= b) call abort()
30   end subroutine check_r8
31
32   subroutine check_r4 (a, b)
33     real(kind=4), intent(in) :: a, b
34     if (a /= b) call abort()
35   end subroutine check_r4
36
37   subroutine check_c8 (a, b)
38     complex(kind=8), intent(in) :: a, b
39     if (a /= b) call abort()
40   end subroutine check_c8
41
42   subroutine check_c4 (a, b)
43     complex(kind=4), intent(in) :: a, b
44     if (a /= b) call abort()
45   end subroutine check_c4
46
47 end module mod_check
48
49 program test
50   use mod_check
51   implicit none
52
53   integer(kind=4) :: i4
54   integer(kind=8) :: i8
55   real(kind=4) :: r4
56   real(kind=8) :: r8
57   complex(kind=4) :: c4
58   complex(kind=8) :: c8
59
60 #define TEST(base,exp,var) var = base; call check((var)**(exp),(base)**(exp))
61
62 !!!!! INTEGER BASE !!!!!
63   TEST(3,23,i4)
64   TEST(-3,23,i4)
65   TEST(3_8,43_8,i8)
66   TEST(-3_8,43_8,i8)
67
68   TEST(17_8,int(huge(0_4),kind=8)+1,i8)
69
70 !!!!! REAL BASE !!!!!
71   TEST(0.0,-1,r4)
72   TEST(0.0,-huge(0)-1,r4)
73   TEST(2.0,huge(0),r4)
74   TEST(nearest(1.0,-1.0),-huge(0),r4)
75
76 end program test
77
78 ! { dg-final { cleanup-modules "mod_check" } }