public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/31297]  New: Use of uninitialized variables in libgfortran's I/O
@ 2007-03-21 14:19 burnus at gcc dot gnu dot org
  2007-03-23 21:21 ` [Bug libfortran/31297] " fxcoudert at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-03-21 14:19 UTC (permalink / raw)
  To: gcc-bugs

Found using valgrind:

gfortran gfortran.dg/backspace_5.f
valgrind ./a.out

==15340== Syscall param write(buf) points to uninitialised byte(s)
==15340==    at 0x56000C0: __write_nocancel (in /lib64/libc-2.5.so)
==15340==    by 0x4EBEE90: do_write (unix.c:336)
==15340==    by 0x4EBEF31: fd_flush (unix.c:386)
==15340==    by 0x4EBCBF6: _gfortran_st_write_done (transfer.c:2762)
==15340==    by 0x400BAB: MAIN__ (in
/projects/tob/gcc/gcc/testsuite/gfortran.dg/a.out)
==15340==    by 0x40104B: main (fmain.c:22)

Similarly for:
- backspace_6.f
- write_back.f
- write_rewind_1.f
- write_rewind_2.f
- char_bounds_check_fail_1.f90
- direct_io_2.f90
- unf_io_convert_3.f90


-- 
           Summary: Use of uninitialized variables in libgfortran's I/O
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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

* [Bug libfortran/31297] Use of uninitialized variables in libgfortran's I/O
  2007-03-21 14:19 [Bug libfortran/31297] New: Use of uninitialized variables in libgfortran's I/O burnus at gcc dot gnu dot org
@ 2007-03-23 21:21 ` fxcoudert at gcc dot gnu dot org
  2007-03-24 22:17 ` tkoenig at alice-dsl dot net
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-03-23 21:21 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to fail|                            |4.1.3 4.2.0 4.3.0
   Last reconfirmed|0000-00-00 00:00:00         |2007-03-23 21:21:25
               date|                            |
   Target Milestone|---                         |4.3.0


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


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

* [Bug libfortran/31297] Use of uninitialized variables in libgfortran's I/O
  2007-03-21 14:19 [Bug libfortran/31297] New: Use of uninitialized variables in libgfortran's I/O burnus at gcc dot gnu dot org
  2007-03-23 21:21 ` [Bug libfortran/31297] " fxcoudert at gcc dot gnu dot org
@ 2007-03-24 22:17 ` tkoenig at alice-dsl dot net
  2007-03-24 22:44 ` tkoenig at alice-dsl dot net
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at alice-dsl dot net @ 2007-03-24 22:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from tkoenig at alice-dsl dot net  2007-03-24 22:17 -------
This is a bug in the test case.

I'll commit a correct version.

Thomas


-- 


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


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

* [Bug libfortran/31297] Use of uninitialized variables in libgfortran's I/O
  2007-03-21 14:19 [Bug libfortran/31297] New: Use of uninitialized variables in libgfortran's I/O burnus at gcc dot gnu dot org
  2007-03-23 21:21 ` [Bug libfortran/31297] " fxcoudert at gcc dot gnu dot org
  2007-03-24 22:17 ` tkoenig at alice-dsl dot net
@ 2007-03-24 22:44 ` tkoenig at alice-dsl dot net
  2007-03-24 23:07 ` tkoenig at alice-dsl dot net
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at alice-dsl dot net @ 2007-03-24 22:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from tkoenig at alice-dsl dot net  2007-03-24 22:44 -------
Created an attachment (id=13279)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13279&action=view)
patch for the test cases

All but one of these were errors in the test cases, which are
corrected with this patch.

unf_io_convert_3.f90 is a case where we don't initialize the left-over
bytes when converting.  Hmm... I'll have to look into this some
more.


-- 


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


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

* [Bug libfortran/31297] Use of uninitialized variables in libgfortran's I/O
  2007-03-21 14:19 [Bug libfortran/31297] New: Use of uninitialized variables in libgfortran's I/O burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-03-24 22:44 ` tkoenig at alice-dsl dot net
@ 2007-03-24 23:07 ` tkoenig at alice-dsl dot net
  2007-03-25  9:47 ` tkoenig at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at alice-dsl dot net @ 2007-03-24 23:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from tkoenig at alice-dsl dot net  2007-03-24 23:07 -------
Created an attachment (id=13280)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13280&action=view)
proposed patch

This one also fixes the last case.

It does so by reading size bytes instead of the kind number when
converting endianness.  This makes the buffers initialized, and
also makes sure the number of bytes are the same when
using CONVERT="SWAP" or when using the native format.

Not that I really expect anybody to use CONVERT with 10-byte
reals, anyway :-)


-- 

tkoenig at alice-dsl dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #13279|0                           |1
        is obsolete|                            |


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


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

* [Bug libfortran/31297] Use of uninitialized variables in libgfortran's I/O
  2007-03-21 14:19 [Bug libfortran/31297] New: Use of uninitialized variables in libgfortran's I/O burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-03-24 23:07 ` tkoenig at alice-dsl dot net
@ 2007-03-25  9:47 ` tkoenig at gcc dot gnu dot org
  2007-03-25 20:18 ` tkoenig at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-03-25  9:47 UTC (permalink / raw)
  To: gcc-bugs



-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |tkoenig at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-03-23 21:21:25         |2007-03-25 10:47:44
               date|                            |


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


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

* [Bug libfortran/31297] Use of uninitialized variables in libgfortran's I/O
  2007-03-21 14:19 [Bug libfortran/31297] New: Use of uninitialized variables in libgfortran's I/O burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-03-25  9:47 ` tkoenig at gcc dot gnu dot org
@ 2007-03-25 20:18 ` tkoenig at gcc dot gnu dot org
  2007-03-28  1:28 ` jvdelisle at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-03-25 20:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from tkoenig at gcc dot gnu dot org  2007-03-25 22:18 -------
Subject: Bug 31297

Author: tkoenig
Date: Sun Mar 25 21:17:51 2007
New Revision: 123200

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=123200
Log:
2007-03-25  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR libfortran/31297
        * gfortran.dg/backspace_5.f:  Initialize variable(s).
        * gfortran.dg/backspace_6.f:  Likewise.
        * gfortran.dg/char_bounds_check_fail_1: Likewise.
        * gfortran.dg/direct_io_2.f90:  Likewise.
        * gfortran.dg/write_back.f:  Likewise.
        * gfortran.dg/write_rewind_2.f:  Likewise.
        * gfortran.dg/write_rewind_1.f:  Likewise.
        * gfortran.dg/write_rewind_2.f:  Likewise.


Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/backspace_5.f
    trunk/gcc/testsuite/gfortran.dg/backspace_6.f
    trunk/gcc/testsuite/gfortran.dg/char_bounds_check_fail_1.f90
    trunk/gcc/testsuite/gfortran.dg/direct_io_2.f90
    trunk/gcc/testsuite/gfortran.dg/write_back.f
    trunk/gcc/testsuite/gfortran.dg/write_rewind_1.f
    trunk/gcc/testsuite/gfortran.dg/write_rewind_2.f


-- 


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


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

* [Bug libfortran/31297] Use of uninitialized variables in libgfortran's I/O
  2007-03-21 14:19 [Bug libfortran/31297] New: Use of uninitialized variables in libgfortran's I/O burnus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-03-25 20:18 ` tkoenig at gcc dot gnu dot org
@ 2007-03-28  1:28 ` jvdelisle at gcc dot gnu dot org
  2007-03-28 19:47 ` tkoenig at gcc dot gnu dot org
  2007-05-18 19:53 ` jb at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-03-28  1:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jvdelisle at gcc dot gnu dot org  2007-03-28 02:28 -------
I think this can be closed.  No need to backport.  RE-open if anyone disagrees.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug libfortran/31297] Use of uninitialized variables in libgfortran's I/O
  2007-03-21 14:19 [Bug libfortran/31297] New: Use of uninitialized variables in libgfortran's I/O burnus at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-03-28  1:28 ` jvdelisle at gcc dot gnu dot org
@ 2007-03-28 19:47 ` tkoenig at gcc dot gnu dot org
  2007-05-18 19:53 ` jb at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-03-28 19:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from tkoenig at gcc dot gnu dot org  2007-03-28 20:47 -------
Hi Jerry,

there is still the issue with kind=10 reals written with
CONVERT="swap".

Reopening until we've decided what to do with that :-)

Thomas


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


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


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

* [Bug libfortran/31297] Use of uninitialized variables in libgfortran's I/O
  2007-03-21 14:19 [Bug libfortran/31297] New: Use of uninitialized variables in libgfortran's I/O burnus at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2007-03-28 19:47 ` tkoenig at gcc dot gnu dot org
@ 2007-05-18 19:53 ` jb at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: jb at gcc dot gnu dot org @ 2007-05-18 19:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jb at gcc dot gnu dot org  2007-05-18 20:52 -------
Seems unf_io_convert_3.f90 is fixed by the patch for PR31915, which adds
padding for CONVERT. The patch was committed as r124741. Closing, please verify
and reopen if I'm wrong.


-- 

jb at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2007-05-18 19:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-21 14:19 [Bug libfortran/31297] New: Use of uninitialized variables in libgfortran's I/O burnus at gcc dot gnu dot org
2007-03-23 21:21 ` [Bug libfortran/31297] " fxcoudert at gcc dot gnu dot org
2007-03-24 22:17 ` tkoenig at alice-dsl dot net
2007-03-24 22:44 ` tkoenig at alice-dsl dot net
2007-03-24 23:07 ` tkoenig at alice-dsl dot net
2007-03-25  9:47 ` tkoenig at gcc dot gnu dot org
2007-03-25 20:18 ` tkoenig at gcc dot gnu dot org
2007-03-28  1:28 ` jvdelisle at gcc dot gnu dot org
2007-03-28 19:47 ` tkoenig at gcc dot gnu dot org
2007-05-18 19:53 ` jb at gcc dot gnu dot 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).