OSDN Git Service

2008-02-21 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / mvbits_1.f90
1 ! PR 25577
2 ! MVBITS didn't work correctly for integer types wider than a C int
3 ! The testcase is based on the one Dale Ranta posted in the bug report
4 implicit none
5 integer(1) i1,j1
6 integer(2) i2,j2
7 integer(4) i4,j4
8 integer(8) i8,j8
9 integer ibits,n
10
11 ibits=bit_size(1_1)
12 do n=1,ibits
13    i1=-1
14    call mvbits(1_1, 0,n,i1,0)
15    j1=-1-2_1**n+2
16    if(i1.ne.j1)call abort
17 enddo
18 ibits=bit_size(1_2)
19 do n=1,ibits
20    i2=-1
21    call mvbits(1_2, 0,n,i2,0)
22    j2=-1-2_2**n+2
23    if(i2.ne.j2)call abort
24 enddo
25 ibits=bit_size(1_4)
26 do n=1,ibits
27    i4=-1
28    call mvbits(1_4, 0,n,i4,0)
29    j4=-1-2_4**n+2
30    if(i4.ne.j4)call abort
31 enddo
32 ibits=bit_size(1_8)
33 do n=1,ibits
34    i8=-1
35    call mvbits(1_8, 0,n,i8,0)
36    j8=-1-2_8**n+2
37    if(i8.ne.j8)call abort
38 enddo
39 end