This is strange:

$ cat minval.f90
program main
  integer :: i
  data i /z'7f800000'/
  real :: a(1)
  a(1) = transfer(i,a(1))  ! a(1) contains +Inf
  print *,a(1), minval(a)
  if (a(1) > minval(a)) print *,"Strange..."
end program main
$ gfortran minval.f90
$ ./a.out
      +Infinity  3.4028235E+38
 Strange...

Ifort gets this right:

$ ifort minval.f90
$ ./a.out
 Infinity       Infinity

We should really be initializing our starting values to +/-Inf, both
in the library and the front end.

Related, of course, to PR 30512.


-- 
           Summary: minval/maxval with +/-Inf
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org
 BugsThisDependsOn: 30512


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

Reply via email to