The MAXLOC and MINLOC functions give an off by one wrong
answer when there is a mask argument.

Dick Hendrickson

      program GA4076

! fails on Windows XP
! gcc version 4.4.0 20080312 (experimental) [trunk revision 133139]

      REAL DDA(100)
      dda = (/(J1,J1=1,100)/)

      IDS = MAXLOC(DDA,1)
      print *, 1, ids, ids.eq.100         !expect 100

      IDS = MAXLOC(DDA,1, (/(J1,J1=1,100)/) > 50)
      print *, 2, ids, ids.eq.100         !expect 100

      IDS = minLOC(DDA,1)
      print *, 3, ids, ids.eq.1           !expect 1

      IDS = MinLOC(DDA,1, (/(J1,J1=1,100)/) > 50)
      print *, 4, ids, ids.eq.51          !expect 51

      END 

C:\gfortran:gfortran ga4076.f

C:\gfortran:a
           1         100 T
           2         101 F
           3           1 T
           4          52 F


-- 
           Summary: MAXLOC and MINLOC off by one with mask
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dick dot hendrickson at gmail dot com


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

Reply via email to