2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / integer_exponentiation_4.f90
blob655f6514c57950bf2b74da32a2ca700b2b52c2e8
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 print *, (2.0,-4.3)**huge(0) ! { dg-error "Arithmetic overflow" }
42 print *, (2.0,-4.3)**huge(0_8) ! { dg-error "Arithmetic overflow" }
43 print *, (2.0,-4.3)**(-huge(0))
44 print *, (2.0,-4.3)**(-huge(0_8))
46 end program test