OSDN Git Service

2011-10-20 Steven G. Kargl <kargl@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / ishft_3.f90
1 ! { dg-do compile }
2 ! PR fortran/50514
3 program ishft_3
4
5    implicit none
6
7    integer j, m
8
9    m = 42
10    !
11    ! These should compile.
12    !
13    j = ishft(m, 16)
14    j = ishft(m, -16)
15    j = ishftc(m, 16)
16    j = ishftc(m, -16)
17    !
18    ! These should issue an error.
19    !
20    j = ishft(m, 640)    ! { dg-error "absolute value of SHIFT" }
21    j = ishftc(m, 640)   ! { dg-error "absolute value of SHIFT" }
22    j = ishft(m, -640)   ! { dg-error "absolute value of SHIFT" }
23    j = ishftc(m, -640)  ! { dg-error "absolute value of SHIFT" }
24
25    ! abs(SHIFT) must be <= SIZE
26
27    j = ishftc(m,  1, 2)
28    j = ishftc(m,  1, 2)
29    j = ishftc(m, -1, 2)
30    j = ishftc(m, -1, 2)
31
32    j = ishftc(m,  10, 2)! { dg-error "absolute value of SHIFT" }
33    j = ishftc(m,  10, 2)! { dg-error "absolute value of SHIFT" }
34    j = ishftc(m, -10, 2)! { dg-error "absolute value of SHIFT" }
35    j = ishftc(m, -10, 2)! { dg-error "absolute value of SHIFT" }
36
37    j = ishftc(m, 1, -2) ! { dg-error "must be positive" }
38 end program