From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14012 invoked by alias); 9 Jan 2014 15:44:22 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 13964 invoked by uid 55); 9 Jan 2014 15:44:19 -0000 From: "sgk at troutmask dot apl.washington.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input Date: Thu, 09 Jan 2014 15:44:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: minor X-Bugzilla-Who: sgk at troutmask dot apl.washington.edu X-Bugzilla-Status: NEW X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-01/txt/msg00924.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59700 --- Comment #6 from Steve Kargl --- On Thu, Jan 09, 2014 at 09:27:18AM +0000, dominiq at lps dot ens.fr wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59700 > > --- Comment #4 from Dominique d'Humieres --- > > Created attachment 31760 [details] > > list_io.diff > > > > The attached patch fixes the code in comment #1. I'm currently > > doing the regtest. > > The patch fixes the problem (at least integer and real) without regression. > I don't know how to test that it does not reintroduce memory leak (though I > doubt it will). > > Would it help if I write a test case and do the packaging? > I've started to write a testcase, but the counting of items is still wrong. Look for the XXX comment in the following code. I can't find where the item count is incremented in this particular situation. Probably need Jan or Jerry to look at this code. ! { dg-do run } program foo implicit none character(len=80) msg integer, parameter :: fd = 10 integer i1, i2, i3, i4 real x1, x2, x3, x4 complex c1, c2 logical a open(unit=fd, status='scratch') write(fd, '(A)') '1 2 3.4 q' rewind(fd) msg = 'ok' read(fd, *, err=10, iomsg=msg) i1, i2, i3, i4 10 if (msg /= 'Bad integer for item 3 in list input') call abort rewind(fd) msg = 'ok' read(fd, *, err=20, iomsg=msg) x1, x2, x3, x4 20 if (msg /= 'Bad real number in item 4 of list input') call abort rewind(fd) msg = 'ok' ! XXX The following line gives 'Bad logical value while reading item 5', ! XXX so the item count is off by one. read(fd, *, err=30, iomsg=msg) i1, x2, x1, a 30 if (msg /= 'Bad logical value while reading item 4') call abort read(fd, *, err=31, iomsg=msg) i1, x2, a, x1 31 if (msg /= 'Bad repeat count in item 3 of list input') call abort close(fd) open(unit=fd, status='scratch') write(fd, '(A)') '(1, 2) (3.4, q)' rewind(fd) msg = 'ok' read(fd, *, err=40, iomsg=msg) c1, c2 40 if (msg /= 'Bad floating point number for item 2') call abort close(fd) end program foo