public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30404]  New: Wrong FORALL result
@ 2007-01-08  9:48 dominiq at lps dot ens dot fr
  2007-01-08 11:23 ` [Bug fortran/30404] " pault at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-01-08  9:48 UTC (permalink / raw)
  To: gcc-bugs

On OSX 10.3 PPC with gfortran version 4.3.0 20070105, the following code:

! tests FORALL statements with a mask
program forall_8
  real, dimension (5, 5, 5, 5) :: a, b, c, d

  a (:, :, :, :) = 4
  forall (i = 1:5)
    a (i, i, 6 - i, i) = 7
  end forall
  forall (i = 1:5)
    a (i, 6 - i, i, i) = 7
  end forall
  forall (i = 1:5)
    a (6 - i, i, i, i) = 7
  end forall
  forall (i = 1:5:2)
    a (1, 2, 3, i) = 0
  end forall

  b (:, :, :, :) = 4
  do i = 1, 5
    b(6 - i, i, i, i) = 7
    b(i, 6 - i, i, i) = 7
    b(i, i, 6 - i, i) = 7
  end do
  b(1, 2, 3, 1) = 0
  b(1, 2, 3, 3) = 0
  b(1, 2, 3, 5) = 0

  if (any (a /= b )) call abort ()

  forall (i = 1:5, j = 1:5, k = 1:5, ((a (i, j, k, i) .gt. 6) .or. (a (i, j, k,
j) .gt. 6)))
      forall (l = 1:5, a (1, 2, 3, l) .lt. 2)
        b (i, j, k, l) = i - j + k - l + 0.5
      end forall
  end forall

  forall (i = 1:5, j = 1:5, a (i, j, 1, 1) .lt. 8)
!  forall (i = 1:5, j = 1:5)
    forall (k = 1:5, ((a (i, j, k, i) .gt. 6) .or. (a (i, j, k, j) .gt. 6)))
      forall (l = 1:5, a (1, 2, 3, l) .lt. 2)
        a (i, j, k, l) = i - j + k - l + 0.5
      end forall
    end forall
  end forall

  print *, a(5, 1, 1, 1), b(5, 1, 1, 1)
  if (any (a /= b )) call abort ()

end

gives:

   7.000000       4.500000    
Abort

I get the same result on AMD64. If I replace

  forall (i = 1:5, j = 1:5, a (i, j, 1, 1) .lt. 8)

by

  forall (i = 1:5, j = 1:5)

I get a segmentation fault on OSX, but not on AMD64.


-- 
           Summary: Wrong FORALL result
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dominiq at lps dot ens dot fr


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30404


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-02-10 16:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-08  9:48 [Bug fortran/30404] New: Wrong FORALL result dominiq at lps dot ens dot fr
2007-01-08 11:23 ` [Bug fortran/30404] " pault at gcc dot gnu dot org
2007-01-08 12:23 ` pault at gcc dot gnu dot org
2007-01-11 16:56 ` roger at eyesopen dot com
2007-01-11 17:26 ` kargl at gcc dot gnu dot org
2007-01-16 18:15 ` sayle at gcc dot gnu dot org
2007-01-29  3:27 ` sayle at gcc dot gnu dot org
2007-02-10 16:24 ` [Bug fortran/30404] [4.1 only] " fxcoudert at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).