This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
f95 standard question
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>
- Date: Mon, 30 May 2005 09:23:16 -0700
- Subject: f95 standard question
(Third attempt, the message appears to be getting blocked)
While documenting and checking the count intrinsic I get the following:
program test_count
integer, dimension(2,3) :: a, b
a = reshape( (/ 1, 3, 5, 2, 4, 6 /), (/ 2, 3 /))
b = reshape( (/ 0, 3, 5, 7, 4, 8 /), (/ 2, 3 /))
!print *, shape(a)
print '(3i6.1)', a
print *
!print *, shape(b)
print '(3i6.1)', b
print *
!print *, shape(a.ne.b)
print '(3l6)', a.ne.b
print *
print *, count(a.ne.b)
print *
print *, count(a.ne.b, DIM=1)
print *
print *, count(a.ne.b, DIM=2)
end program test_count
$ gfc count.f90
$ ./a.out
1 3 5
2 4 6
0 3 5
7 4 8
T F F
T F T
3
1 1 1
1 2
I get the same result with ifort as gfc, however, the draft f95 standard
that I have to look at states that the case of DIM=1 should be:
[2, 0, 1] and not [1, 1, 1]
which makes sense eyeballing it, but I have two compilers that agree to
diaagree with the standard. Keeping in mind I have only a draft
standard (section 13.14.24) that could be wrong, (of course I could be
wrong too).
A second note, the program segfaults if I set DIM=3 which is illegal and
ifort catches that at compile time.
Any opinions please?
Jerry