aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/ishft_3.f90
blob: 626e71ce44ef7347435821fc1f01f9e9a1cd1243 (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
34
35
36
37
38
! { dg-do compile }
! PR fortran/50514
program ishft_3

   implicit none

   integer j, m

   m = 42
   !
   ! These should compile.
   !
   j = ishft(m, 16)
   j = ishft(m, -16)
   j = ishftc(m, 16)
   j = ishftc(m, -16)
   !
   ! These should issue an error.
   !
   j = ishft(m, 640)    ! { dg-error "absolute value of SHIFT" }
   j = ishftc(m, 640)   ! { dg-error "absolute value of SHIFT" }
   j = ishft(m, -640)   ! { dg-error "absolute value of SHIFT" }
   j = ishftc(m, -640)  ! { dg-error "absolute value of SHIFT" }

   ! abs(SHIFT) must be <= SIZE

   j = ishftc(m,  1, 2)
   j = ishftc(m,  1, 2)
   j = ishftc(m, -1, 2)
   j = ishftc(m, -1, 2)

   j = ishftc(m,  10, 2)! { dg-error "absolute value of SHIFT" }
   j = ishftc(m,  10, 2)! { dg-error "absolute value of SHIFT" }
   j = ishftc(m, -10, 2)! { dg-error "absolute value of SHIFT" }
   j = ishftc(m, -10, 2)! { dg-error "absolute value of SHIFT" }

   j = ishftc(m, 1, -2) ! { dg-error "must be positive" }
end program