OSDN Git Service

a05986fcb8f87f8cca83b8bedebf9a3c85e455f1
[pf3gnuchains/pf3gnuchains3x.git] / gcc / testsuite / gfortran.dg / real_const_3.f90
1 !{ dg-do run }
2 !{ dg-options "-fno-range-check" }
3 !{ dg-options "-fno-range-check -mieee" { target sh*-*-* } }
4 ! PR19310 and PR19904, allow disabling range check during compile.
5 ! Contributed by Jerry DeLisle  <jvdelisle@gcc.gnu.org>
6 program main
7   character(len=80) str
8   real, parameter :: zero=0, nan=0/zero
9   complex :: z = (-0.1,-2.2)/(0.0,0.0)
10   complex :: z2 = (0.1,1)/0
11   complex :: z3 = (1e35, -2e3)/1.234e-37
12   complex :: z4 = (1e-35, -2e-35)/1234e34
13   real :: a
14   a = exp(1000.0)
15   b = 1/exp(1000.0)
16
17   write(str,*) a
18   if (trim(adjustl(str)) .ne. '+Infinity') call abort
19
20   if (b .ne. 0.) call abort
21
22   write(str,*) -1.0/b
23   if (trim(adjustl(str)) .ne. '-Infinity') call abort
24
25   write(str,*) b/0.0
26   if (trim(adjustl(str)) .ne. 'NaN') call abort
27
28   write(str,*) 0.0/0.0
29   if (trim(adjustl(str)) .ne. 'NaN') call abort
30
31   write(str,*) 1.0/(-0.)
32   if (trim(adjustl(str)) .ne. '-Infinity') call abort
33
34   write(str,*) -2.0/0.
35   if (trim(adjustl(str)) .ne. '-Infinity') call abort
36
37   write(str,*) 3.0/0.
38   if (trim(adjustl(str)) .ne. '+Infinity') call abort
39
40   write(str,*)  nan
41   if (trim(adjustl(str)) .ne. 'NaN') call abort
42
43   write(str,*) z
44   if (trim(adjustl(str)) .ne. '(            NaN,            NaN)') call abort
45
46   write(str,*) z2
47   if (trim(adjustl(str)) .ne. '(            NaN,            NaN)') call abort
48
49   write(str,*) z3
50   if (trim(adjustl(str)) .ne. '(      +Infinity,      -Infinity)') call abort
51
52   write(str,*) z4
53   if (trim(adjustl(str)) .ne. '(  0.0000000    , -0.0000000    )') call abort
54
55 end program main