2009-10-05 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / integer_exponentiation_4.f90
blobe934d285794c93a86014caa86ebc9d872dd341df
1 ! { dg-do compile }
2 ! { dg-options "" }
3 program test
4 implicit none
6 !!!!!! INTEGER BASE !!!!!!
7 print *, 0**0
8 print *, 0**1
9 print *, 0**(-1) ! { dg-error "Division by zero" }
10 print *, 0**(huge(0))
11 print *, 0**(-huge(0)-1) ! { dg-error "Division by zero" }
12 print *, 0**(2_8**32)
13 print *, 0**(-(2_8**32)) ! { dg-error "Division by zero" }
15 print *, 1**huge(0)
16 print *, 1**(-huge(0)-1)
17 print *, 1**huge(0_8)
18 print *, 1**(-huge(0_8)-1_8)
19 print *, (-1)**huge(0)
20 print *, (-1)**(-huge(0)-1)
21 print *, (-1)**huge(0_8)
22 print *, (-1)**(-huge(0_8)-1_8)
24 print *, 2**huge(0) ! { dg-error "Arithmetic overflow" }
25 print *, 2**huge(0_8) ! { dg-error "Arithmetic overflow" }
26 print *, (-2)**huge(0) ! { dg-error "Arithmetic overflow" }
27 print *, (-2)**huge(0_8) ! { dg-error "Arithmetic overflow" }
29 print *, 2**(-huge(0)-1)
30 print *, 2**(-huge(0_8)-1_8)
31 print *, (-2)**(-huge(0)-1)
32 print *, (-2)**(-huge(0_8)-1_8)
34 !!!!!! REAL BASE !!!!!!
35 print *, 0.0**(-1) ! { dg-error "Arithmetic overflow" }
36 print *, 0.0**(-huge(0)-1) ! { dg-error "Arithmetic overflow" }
37 print *, 2.0**huge(0) ! { dg-error "Arithmetic overflow" }
38 print *, nearest(1.0,-1.0)**(-huge(0)) ! { dg-error "Arithmetic overflow" }
40 !!!!!! COMPLEX BASE !!!!!!
41 ! Put these lines back in (and "no-" -> "dg-") prior to gcc-4.5.
42 ! print *, (2.0,-4.3)**huge(0) ! { no-error "Arithmetic overflow" }
43 ! print *, (2.0,-4.3)**huge(0_8) ! { no-error "Arithmetic overflow" }
44 ! print *, (2.0,-4.3)**(-huge(0))
45 ! print *, (2.0,-4.3)**(-huge(0_8))
47 end program test