public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/61187] New: valgrind errors if stdin is closed
@ 2014-05-14 12:47 jb at gcc dot gnu.org
  2014-05-16 20:37 ` [Bug libfortran/61187] " jb at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jb at gcc dot gnu.org @ 2014-05-14 12:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61187

            Bug ID: 61187
           Summary: valgrind errors if stdin is closed
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jb at gcc dot gnu.org

In some cases STDIN_FILENO (0 in POSIX) can be closed. This happens e.g. for
rank != 0 MPI processes with MPICH2. This results in valgrind complaining about
uninitialized variables. 

Test program:

! Compile and run with
! gfortran -g otest.f90
! mpirun -np 2 valgrind --track-origins=yes a.out
program otest
  implicit none
  print *, "hello"
end program


Running via mpirun from mvapich2 1.8 and gcc 4.9.0 and strace shows:

fstat(0, fstat(0, 0x7ffff4ee09d0)                = -1 EBADF (Bad file
descriptor)

In unix.c(fd_to_stream) we don't check the return value of fstat before
accessing statbuf.

See https://gcc.gnu.org/ml/fortran/2014-04/msg00081.html for original bug
report.


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

end of thread, other threads:[~2014-05-25 19:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-14 12:47 [Bug libfortran/61187] New: valgrind errors if stdin is closed jb at gcc dot gnu.org
2014-05-16 20:37 ` [Bug libfortran/61187] " jb at gcc dot gnu.org
2014-05-16 20:43 ` jb at gcc dot gnu.org
2014-05-16 20:48 ` jb at gcc dot gnu.org
2014-05-20 18:16 ` dominiq at lps dot ens.fr
2014-05-25 19:29 ` jb at gcc dot gnu.org
2014-05-25 19:30 ` jb 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).