public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/51250] New: [4.7 Regression] Bug with SUM(,dim,mask)
@ 2011-11-20 23:22 anlauf at gmx dot de
  2011-11-21  0:51 ` [Bug fortran/51250] " dominiq at lps dot ens.fr
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: anlauf at gmx dot de @ 2011-11-20 23:22 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51250
           Summary: [4.7 Regression] Bug with SUM(,dim,mask)
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: anlauf@gmx.de


The following program produces a wrong result:

program gfcbug115
  implicit none
  integer :: n_obstype = 2
  integer :: nboxes = 1
  integer :: nprocs = 1
  integer :: nbox, j
  integer, allocatable :: nbx(:,:), pes(:)

  allocate (pes(nboxes))
  allocate (nbx(n_obstype,nboxes))
  nbx(:,:) = 1
  do j = 1, nboxes
     pes(j) = modulo (j-1, nprocs)
  end do
  do nbox=1, nboxes
     print '(20i4)', nbox, nbx(:,nbox)
  end do
  do j = 0, nprocs-1
     print '(i4,20l4)', j, spread (pes==j,dim=1,ncopies=n_obstype)
     print '(20i4)', j, &
          sum (nbx,dim=2,mask=spread (pes==j,dim=1,ncopies=n_obstype)), &
          shape (sum (nbx,dim=2,mask=spread (pes==j,dim=1,ncopies=n_obstype)))
  end do
end program gfcbug115


gfortran 4.7 svn rev. 181390:

   1   1   1
   0   T   T
   0   1   1

gfortran 4.6 and earlier:
   1   1   1
   0   T   T
   0   1   1   2

The latter is correct.


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

end of thread, other threads:[~2011-11-25 21:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-20 23:22 [Bug fortran/51250] New: [4.7 Regression] Bug with SUM(,dim,mask) anlauf at gmx dot de
2011-11-21  0:51 ` [Bug fortran/51250] " dominiq at lps dot ens.fr
2011-11-21  8:07 ` burnus at gcc dot gnu.org
2011-11-22 19:34 ` mikael at gcc dot gnu.org
2011-11-24  0:37 ` mikael at gcc dot gnu.org
2011-11-25  0:59 ` anlauf at gmx dot de
2011-11-26  7:15 ` mikael at gcc dot gnu.org
2011-11-26  9:22 ` mikael at gcc dot gnu.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).