public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pault at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/30404] Wrong FORALL result
Date: Mon, 08 Jan 2007 11:23:00 -0000	[thread overview]
Message-ID: <20070108112323.20766.qmail@sourceware.org> (raw)
In-Reply-To: <bug-30404-12313@http.gcc.gnu.org/bugzilla/>



------- Comment #1 from pault at gcc dot gnu dot org  2007-01-08 11:23 -------
There appears to be a double problem here; the segfault, which I can reproduce
by adding more statements in the forall block that sets a, and the incorrect
rendering of the mask logic, according to where the masking is applied.

The program below illustrates the problem more simply.

I have cc'd Roger Sayle.

Paul

  integer, dimension (3, 3) :: a, b, c
  logical, dimension (3,3) :: l1 = .FALSE.
  integer :: i, j

  a = 2
  a (1,1) = 1
  a (3,3) = 1
  a (2,1) = 3
  a (2,3) = 3

  b = a
  c = a

  forall (i = 1:3, a(i, 1) == 1)     ! mask true for i = 1
    forall (j = 1:3, a(2, j) == 3)   ! mask true for j = 1,3
      b (i, j) = 99                  ! set for (i = 1) && (j = 1,3)
      l1 (i, j) = .TRUE.
    end forall
  end forall

   forall (i = 1:3, a(i, 1) .lt. 1000)
    forall (j = 1:3, l1(i, j))       ! mask true for (i = 1) && (j = 1,3)
      c (i, j) = 99                  ! SHOULD be set for (i = 1) && (j = 1,3)
    end forall
  end forall

!  forall (i = 1:3) !                 this segfaults
   forall (i = 1:3, a(i, 1) .lt. 1000)
    forall (j = 1:3, &
 (a(i, 1) == 1 .and. a(2, j) == 3))  ! mask true for (i = 1) && (j = 1,3)
      a (i, j) = 99                  ! SHOULD be set for (i = 1) && (j = 1,3)
    end forall
  end forall

  print *, a                         ! a remains unchanged for gfortran
  print *, b                         ! b is changed correctly
  print *, c                         ! c(2,:) == 99 *sigh*

! Other compilers end up with a == b == c
end


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sayle at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-01-08 11:23:23
               date|                            |


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


  reply	other threads:[~2007-01-08 11:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-08  9:48 [Bug fortran/30404] New: " dominiq at lps dot ens dot fr
2007-01-08 11:23 ` pault at gcc dot gnu dot org [this message]
2007-01-08 12:23 ` [Bug fortran/30404] " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070108112323.20766.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).