OSDN Git Service

2004-07-21 David Billinghurst (David.Billinghurst@riotinto.com)
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / g77 / 13037.f
1 c { dg-do run }
2 c      PR optimization/13037
3 c      Contributed by Kirill Smelkov
4 c      bug symptom: zeta(kkzc) seems to reference to zeta(kkzc-1) instead
5 c      with gcc-3.2.2 it is OK, so it is a regression.
6 c
7       subroutine bug1(expnt)
8       implicit none
9
10       double precision zeta
11       common /bug1_area/zeta(3)
12
13       double precision expnt(3)
14
15
16       integer k, kkzc
17
18       kkzc=0
19       do k=1,3
20          kkzc = kkzc + 1
21          zeta(kkzc) = expnt(k)
22       enddo
23
24 c     the following line activates the bug
25       call bug1_activator(kkzc)
26       end
27
28
29 c     dummy subroutine
30       subroutine bug1_activator(inum)
31       implicit none
32       integer inum
33       end
34
35
36 c     test driver
37       program test_bug1
38       implicit none
39
40       double precision zeta
41       common /bug1_area/zeta(3)
42
43       double precision expnt(3)
44
45       zeta(1) = 0.0d0
46       zeta(2) = 0.0d0
47       zeta(3) = 0.0d0
48
49       expnt(1) = 1.0d0
50       expnt(2) = 2.0d0
51       expnt(3) = 3.0d0
52
53       call bug1(expnt)
54       if ((zeta(1).ne.1) .or. (zeta(2).ne.2) .or. (zeta(3).ne.3)) then
55         call abort
56       endif
57
58       end
59