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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [do_1.f90] - Blame information for rev 827

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
! { dg-do run }
2
! Program to check corner cases for DO statements.
3
program do_1
4
  implicit none
5
  integer i, j
6
 
7
  ! limit=HUGE(i), step 1
8
  j = 0
9
  do i = HUGE(i) - 10, HUGE(i), 1
10
    j = j + 1
11
  end do
12
  if (j .ne. 11) call abort
13
  ! limit=HUGE(i), step > 1
14
  j = 0
15
  do i = HUGE(i) - 10, HUGE(i), 2
16
    j = j + 1
17
  end do
18
  if (j .ne. 6) call abort
19
  j = 0
20
  do i = HUGE(i) - 9, HUGE(i), 2
21
    j = j + 1
22
  end do
23
  if (j .ne. 5) call abort
24
 
25
  ! Same again, but unknown loop step
26
  if (test1(10, 1) .ne. 11) call abort
27
  if (test1(10, 2) .ne. 6) call abort
28
  if (test1(9, 2) .ne. 5) call abort
29
 
30
  ! Zero iterations
31
  j = 0
32
  do i = 1, 0, 1
33
    j = j + 1
34
  end do
35
  if (j .ne. 0) call abort
36
  j = 0
37
  do i = 1, 0, 2
38
    j = j + 1
39
  end do
40
  if (j .ne. 0) call abort
41
  j = 0
42
  do i = 1, 2, -1
43
    j = j + 1
44
  end do
45
  if (j .ne. 0) call abort
46
  call test2 (0, 1)
47
  call test2 (0, 2)
48
  call test2 (2, -1)
49
  call test2 (2, -2)
50
 
51
  ! Bound near smallest value
52
  j = 0;
53
  do i = -HUGE(i), -HUGE(i), 10
54
    j = j + 1
55
  end do
56
  if (j .ne. 1) call abort
57
contains
58
! Returns the number of iterations performed.
59
function test1(r, step)
60
  implicit none
61
  integer test1, r, step
62
  integer k, n
63
  k = 0
64
  do n = HUGE(n) - r, HUGE(n), step
65
    k = k + 1
66
  end do
67
  test1 = k
68
end function
69
 
70
subroutine test2 (lim, step)
71
  implicit none
72
  integer lim, step
73
  integer k, n
74
  k = 0
75
  do n = 1, lim, step
76
    k = k + 1
77
  end do
78
  if (k .ne. 0) call abort
79
end subroutine
80
end program

powered by: WebSVN 2.1.0

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