aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_abs.f90
blob: 9e44657bad148e26479d38af79aac5aa9786dd99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
! Program to test the ABS intrinsic
program intrinsic_abs
   implicit none
   integer i
   real(kind=4) r
   real(kind=8) q
   complex z

   i = 42
   i = abs(i)
   if (i .ne. 42) call abort
   i = -43
   i = abs(i)
   if (i .ne. 43) call abort

   r = 42.0
   r = abs(r)
   if (r .ne. 42.0) call abort
   r = -43.0
   r = abs(r)
   if (r .ne. 43.0) call abort

   q = 42.0_8
   q = abs(q)
   if (q .ne. 42.0_8) call abort
   q = -43.0_8
   q = abs(q)
   if (q .ne. 43.0_8) call abort

   z = (3, 4)
   r = abs(z)
   if (r .ne. 5) call abort
end program