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

           Summary: Wrong I/O output (only) when running under valgrind
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: bur...@gcc.gnu.org
                CC: jvdeli...@gcc.gnu.org


There is something odd with the following program. It shows (here) always the
correct output -- except I run it through valgrind.

(The program is from
http://groups.google.com/group/comp.lang.fortran/msg/cb8e13e6226bc6c5 (part of
the c.l.f thread
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/1b907e3b7b6f3461).
James reports that it fails on MinGW with the www.equation.com version but not
with the MinGW version.)

Without valgrind, the program prints (with GCC 4.6 and 4.5 and any optimization
level):
  3.36210314311209350626E-4912
  ...
  3.36210314311209350626E-4912
  1.18973149535723176502E+4932
  ...
  1.18973149535723176502E+4932

However, using valgrind I get:
   0.0000000000000000000
   ...
   0.0000000000000000000
  i.f                   E+0000
   ...
  i.f                   E+0000

But otherwise no warning and no leakage.

Using GCC 4.5, I get with valgrind "0.0000" and "+Infinity".

The issue seems to be in libgfortran as the result depends on the library and
not on the FE compiler. I am also not sure whether there is a real issue or
whether it is just a side effect of valgrind.


program bugs2
   implicit none
   integer, parameter :: ep = 10
   real(ep) x
   integer i

   x = tiny(x)
   write(*,*) x
   do i = 1, 10
      x = 100*x
      write(*,*) x
   end do
   x = huge(x)
   write(*,*) x
   do i = 1, 10
      x = x/1.0e100_ep
      write(*,*) x
   end do
end program bugs2

Reply via email to