Debian Codegraph @

gcc/testsuite/gfortran.fortran-torture/compile/transfer-1.f90

raw
1 ! Bigendian test posted by Perseus in comp.lang.fortran on 4 July 2005.
2 integer(1), parameter :: zero = 0
3 LOGICAL, PARAMETER :: bigend = IACHAR(TRANSFER(1,"a")) == zero
4 LOGICAL :: bigendian
5 call foo ()
6 contains
7 subroutine foo ()
8 integer :: chr, ans
9 if (bigend) then
10 ans = 1
11 else
12 ans = 0
13 end if
14 chr = IACHAR(TRANSFER(1,"a"))
15 bigendian = chr == 0_4
16 if (bigendian) then
17 ans = 1
18 else
19 ans = 0
20 end if
21 end subroutine foo
22 end