OSDN Git Service

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