This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/32298] New: Intrinsic MINLOC / MAXLOC gives wrong results (gfortran build 20070522)


The following source code:
!-------------------------
PROGRAM ERR_MINLOC

   INTEGER, PARAMETER :: N = 7

   DOUBLE PRECISION, DIMENSION (N), PARAMETER :: A &
     = (/ 0.3D0, 0.455D0, 0.6D0, 0.7D0, 0.72D0, 0.76D0, 0.79D0 /)

   DOUBLE PRECISION :: B
   INTEGER          :: I, J, K

  DO I = 1, N
    B = A(I)
    J = MINLOC (ABS (A - B), 1)
    K = MAXLOC (ABS (A - B), 1)
    PRINT *, I, J, K
  END DO  
 STOP

END PROGRAM ERR_MINLOC
!----------------------

gives the following result:
(superflouos blanks are deleted):
--------------------------
 1 2 7
 2 2 7
 3 3 7
 4 4 2
 5 5 2
 6 6 2
 7 7 2
--------------------------

The correct result is:
--------------------------
 1 1 7
 2 2 7
 3 3 1
 4 4 1
 5 5 1
 6 6 1
 7 7 1
--------------------------


-- 
           Summary: Intrinsic MINLOC / MAXLOC gives wrong results (gfortran
                    build 20070522)
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jens dot bischoff at freenet dot de
GCC target triplet: i386-pc-mingw32


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]