From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16093 invoked by alias); 10 Dec 2005 16:39:28 -0000 Received: (qmail 16076 invoked by uid 48); 10 Dec 2005 16:39:26 -0000 Date: Sat, 10 Dec 2005 16:39:00 -0000 Message-ID: <20051210163926.16075.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug libfortran/25139] [4.1/4.2 regression] "Invalid argument" error on I/O In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "fxcoudert at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2005-12/txt/msg01021.txt.bz2 List-Id: ------- Comment #6 from fxcoudert at gcc dot gnu dot org 2005-12-10 16:39 ------- I found the problem in the second one, which is fixed by the one-line patch: Index: io/file_pos.c =================================================================== --- io/file_pos.c (revision 108353) +++ io/file_pos.c (working copy) @@ -109,13 +109,14 @@ length = sizeof (gfc_offset); - p = salloc_r_at (u->s, &length, - file_position (u->s) - length); + /* length is modified by this function call, and most probably + set to zero. */ + p = salloc_r_at (u->s, &length, file_position (u->s) - length); if (p == NULL) goto io_error; memcpy (&m, p, sizeof (gfc_offset)); - new = file_position (u->s) - m - 2*length; + new = file_position (u->s) - m - sizeof (gfc_offset) - length; if (sseek (u->s, new) == FAILURE) goto io_error; (well, more than one line since I added a comment so that we don't do this mistake again). Since this does not fixed the other problem, I filed it separately under PR 25340. -- fxcoudert at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |fxcoudert at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Keywords| |patch Last reconfirmed|2005-12-10 15:39:19 |2005-12-10 16:39:26 date| | Target Milestone|--- |4.1.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25139