gfortran bug?

Ray Nachlinger ray@ultramarine.com
Wed Dec 6 20:24:00 GMT 2006


The following program produces strange results.

      integer len_l,n
      parameter (n = 5, len_l = 2)
      logical l(n),lt
      parameter (lt = .true.)
c
      call repeat(.true.,len_l,n,   l(1))
      print *,l
c
      call repeat(lt,len_l,n,   l(1))
      print *,l
c
      l(1) = .true.
      call repeat(l(1),len_l,n,   l(2))
      print *,l
c
      end
c
      subroutine repeat(a,len,num,   b)
      integer num,len,k,j
      integer*2 a(num,*),b(num,*)
      do 2100 k = 1, num
      do 2100 j = 1, len
      b(j,k) = a(j,k)
 2100 continue
      end


"repeat" takes the first argument which is len integer*2
length long and copies it num times to the last argument.
As far a I can see, all three calls should produce 5 
.true. values. The first two calls, however, produce
T F T T T. The last one is as I expected. Is this a bug
or am I confused?

I am using gcc version 4.1.1

Thanks,

Ray



More information about the Fortran mailing list