public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/46703] New: Wrong I/O output (only) when running under valgrind
@ 2010-11-29  9:00 burnus at gcc dot gnu.org
  2010-11-29 19:38 ` [Bug fortran/46703] " mikael at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-11-29  9:00 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: jvdelisle@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


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

* [Bug fortran/46703] Wrong I/O output (only) when running under valgrind
  2010-11-29  9:00 [Bug fortran/46703] New: Wrong I/O output (only) when running under valgrind burnus at gcc dot gnu.org
@ 2010-11-29 19:38 ` mikael at gcc dot gnu.org
  2010-12-27  0:23 ` dfranke at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mikael at gcc dot gnu.org @ 2010-11-29 19:38 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #1 from Mikael Morin <mikael at gcc dot gnu.org> 2010-11-29 19:26:37 UTC ---
Maybe yet another of x86's extra floating point precision effects.
I suppose where valgrind needs to do its verifications, it interrupts the
program and saves/restores the registers (to memory), thus losing the extra
precision.

Try to ask to the valgrind developers, the problems looks very
valgrind-related.


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

* [Bug fortran/46703] Wrong I/O output (only) when running under valgrind
  2010-11-29  9:00 [Bug fortran/46703] New: Wrong I/O output (only) when running under valgrind burnus at gcc dot gnu.org
  2010-11-29 19:38 ` [Bug fortran/46703] " mikael at gcc dot gnu.org
@ 2010-12-27  0:23 ` dfranke at gcc dot gnu.org
  2010-12-27  1:04 ` jvdelisle at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dfranke at gcc dot gnu.org @ 2010-12-27  0:23 UTC (permalink / raw)
  To: gcc-bugs

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

Daniel Franke <dfranke at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2010.12.27 00:23:27
                 CC|                            |dfranke at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #2 from Daniel Franke <dfranke at gcc dot gnu.org> 2010-12-27 00:23:27 UTC ---
(In reply to comment #1)
> Maybe yet another of x86's extra floating point precision effects.
> I suppose where valgrind needs to do its verifications, it interrupts the
> program and saves/restores the registers (to memory), thus losing the extra
> precision.

Seconded. Simple test: does -ffloat-store change the output as well?


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

* [Bug fortran/46703] Wrong I/O output (only) when running under valgrind
  2010-11-29  9:00 [Bug fortran/46703] New: Wrong I/O output (only) when running under valgrind burnus at gcc dot gnu.org
  2010-11-29 19:38 ` [Bug fortran/46703] " mikael at gcc dot gnu.org
  2010-12-27  0:23 ` dfranke at gcc dot gnu.org
@ 2010-12-27  1:04 ` jvdelisle at gcc dot gnu.org
  2011-07-24 18:54 ` dfranke at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2010-12-27  1:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2010-12-27 01:03:55 UTC ---
-ffloat-store is the first thing I tried and no change.  However, the run-time
side, libgfortran, is not compiled normally with -ffloat-store so maybe we
should try that.


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

* [Bug fortran/46703] Wrong I/O output (only) when running under valgrind
  2010-11-29  9:00 [Bug fortran/46703] New: Wrong I/O output (only) when running under valgrind burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2010-12-27  1:04 ` jvdelisle at gcc dot gnu.org
@ 2011-07-24 18:54 ` dfranke at gcc dot gnu.org
  2013-05-19  5:01 ` bdavis at gcc dot gnu.org
  2013-05-19 19:35 ` jvdelisle at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: dfranke at gcc dot gnu.org @ 2011-07-24 18:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Daniel Franke <dfranke at gcc dot gnu.org> 2011-07-24 18:53:21 UTC ---
Any news here? May this report be closed?


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

* [Bug fortran/46703] Wrong I/O output (only) when running under valgrind
  2010-11-29  9:00 [Bug fortran/46703] New: Wrong I/O output (only) when running under valgrind burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-07-24 18:54 ` dfranke at gcc dot gnu.org
@ 2013-05-19  5:01 ` bdavis at gcc dot gnu.org
  2013-05-19 19:35 ` jvdelisle at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: bdavis at gcc dot gnu.org @ 2013-05-19  5:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Bud Davis <bdavis at gcc dot gnu.org> ---
It is a problem with Valgrind.
One that is even mentioned in the (valgrind) manual.

https://bugs.kde.org/show_bug.cgi?id=197915

It has been open for about 4 years, not fixed yet.

Short summary.  Don't use valgrind on real's larger than 64 bits.

--bud davis


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

* [Bug fortran/46703] Wrong I/O output (only) when running under valgrind
  2010-11-29  9:00 [Bug fortran/46703] New: Wrong I/O output (only) when running under valgrind burnus at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-05-19  5:01 ` bdavis at gcc dot gnu.org
@ 2013-05-19 19:35 ` jvdelisle at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2013-05-19 19:35 UTC (permalink / raw)
  To: gcc-bugs

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

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |INVALID

--- Comment #7 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Closing as invalid.


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

end of thread, other threads:[~2013-05-19 19:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-29  9:00 [Bug fortran/46703] New: Wrong I/O output (only) when running under valgrind burnus at gcc dot gnu.org
2010-11-29 19:38 ` [Bug fortran/46703] " mikael at gcc dot gnu.org
2010-12-27  0:23 ` dfranke at gcc dot gnu.org
2010-12-27  1:04 ` jvdelisle at gcc dot gnu.org
2011-07-24 18:54 ` dfranke at gcc dot gnu.org
2013-05-19  5:01 ` bdavis at gcc dot gnu.org
2013-05-19 19:35 ` jvdelisle 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).