OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [transfer_simplify_3.f90] - Blame information for rev 694

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do run }
2
! { dg-options "-fno-range-check" }
3
! PR fortran/32083
4
!
5
! Test transfers of +Inf and -Inf
6
! Testcase contributed by Jos de Kloe 
7
!
8
 
9
PROGRAM TestInfinite
10
  IMPLICIT NONE
11
  integer, parameter :: i8_ = Selected_Int_Kind(18)  ! = integer*8
12
  integer, parameter :: r8_ = Selected_Real_Kind(15,307)  ! = real*8
13
 
14
  integer(i8_), parameter :: bit_pattern_PosInf_i8_p = 9218868437227405312_i8_
15
  integer(i8_), parameter :: bit_pattern_NegInf_i8_p = -4503599627370496_i8_
16
 
17
  integer(i8_) :: bit_pattern_PosInf_i8 = 9218868437227405312_i8_
18
  integer(i8_) :: bit_pattern_NegInf_i8 = -4503599627370496_i8_
19
 
20
  integer(i8_) :: bit_pattern_PosInf_i8_hex
21
  integer(i8_) :: bit_pattern_NegInf_i8_hex
22
 
23
  integer(i8_) :: i
24
  real(r8_)    :: r
25
 
26
  data bit_pattern_PosInf_i8_hex /z'7FF0000000000000'/
27
  !data bit_pattern_NegInf_i8_hex /z'FFF0000000000000'/
28
  ! not portable, replaced by:
29
  bit_pattern_NegInf_i8_hex = ibset(bit_pattern_PosInf_i8_hex,63)
30
 
31
  if (bit_pattern_NegInf_i8_hex /= bit_pattern_NegInf_i8) call abort()
32
  if (bit_pattern_PosInf_i8_hex /= bit_pattern_PosInf_i8) call abort()
33
 
34
  r = transfer(bit_pattern_PosInf_i8,r)
35
  if (r /= 1.0_r8_/0.0_r8_) call abort()
36
  i = transfer(r,i)
37
  if (bit_pattern_PosInf_i8 /= i) call abort()
38
 
39
  r = transfer(bit_pattern_NegInf_i8,r)
40
  if (r /= -1.0_r8_/0.0_r8_) call abort()
41
  i = transfer(r,i)
42
  if (bit_pattern_NegInf_i8 /= i) call abort()
43
 
44
  r = transfer(bit_pattern_PosInf_i8_p,r)
45
  if (r /= 1.0_r8_/0.0_r8_) call abort()
46
  i = transfer(r,i)
47
  if (bit_pattern_PosInf_i8_p /= i) call abort()
48
 
49
  r = transfer(bit_pattern_NegInf_i8_p,r)
50
  if (r /= -1.0_r8_/0.0_r8_) call abort()
51
  i = transfer(r,i)
52
  if (bit_pattern_NegInf_i8_p /= i) call abort()
53
END PROGRAM TestInfinite

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.