public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input
@ 2014-01-06 14:45 mvondomaros at gmail dot com
  2014-01-06 23:24 ` [Bug fortran/59700] [4.8/4.9 Regression] " kargl at gcc dot gnu.org
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: mvondomaros at gmail dot com @ 2014-01-06 14:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59700
           Summary: Misleading/buggy runtime error message: Bad integer
                    for item 0 in list input
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mvondomaros at gmail dot com

The following simple program yields:
> Fortran runtime error: Bad integer for item 0 in list input

But unless my understanding of an item in the list input is wrong, I would have
expected:
> Fortran runtime error: Bad integer for item 4 in list input

program foo

    integer :: myunit
    integer :: i1, i2, i3, i4

    open(newunit=myunit, file="test.dat")
    read(myunit, *) i1, i2, i3, i4
    close(myunit)
end program foo

file test.dat:
1 2 3 4.0


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
@ 2014-01-06 23:24 ` kargl at gcc dot gnu.org
  2014-01-07 11:54 ` rguenth at gcc dot gnu.org
                   ` (22 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: kargl at gcc dot gnu.org @ 2014-01-06 23:24 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

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

--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #1)
> r203000 (2013-09-27) gives
> 
> At line 7 of file pr59700.f90
> Fortran runtime error: Bad integer for item 4 in list input
> 
> while r203129 (2013-10-02) gives 'item 0'. It is likely r203086 for trunk
> and r203201 for 4.8.2.
> 
> I think this due to
> 
> +
> +  free_line (dtp);
>    snprintf (message, MSGLEN, "Bad integer for item %d in list input",
>  	      dtp->u.p.item_count);

yep. free_line() explicitly set  dtp->u.p.item_count = 0.  It appears
that the two lines are inverted.  I'm testing a fix now.
>From gcc-bugs-return-439446-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jan 06 23:29:46 2014
Return-Path: <gcc-bugs-return-439446-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 3279 invoked by alias); 6 Jan 2014 23:29:46 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 3246 invoked by uid 55); 6 Jan 2014 23:29:43 -0000
From: "sgk at troutmask dot apl.washington.edu" <gcc-bugzilla@gcc.gnu.org>
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: Mon, 06 Jan 2014 23:29: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: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59700-4-xXstpFXMNE@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59700-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59700-4@http.gcc.gnu.org/bugzilla/>
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/msg00588.txt.bz2
Content-length: 213

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY700

--- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
The attached patch fixes the code in comment #1.  I'm currently
doing the regtest.


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
  2014-01-06 23:24 ` [Bug fortran/59700] [4.8/4.9 Regression] " kargl at gcc dot gnu.org
@ 2014-01-07 11:54 ` rguenth at gcc dot gnu.org
  2014-01-09  9:27 ` dominiq at lps dot ens.fr
                   ` (21 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-01-07 11:54 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.8.3


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
  2014-01-06 23:24 ` [Bug fortran/59700] [4.8/4.9 Regression] " kargl at gcc dot gnu.org
  2014-01-07 11:54 ` rguenth at gcc dot gnu.org
@ 2014-01-09  9:27 ` dominiq at lps dot ens.fr
  2014-01-09 15:39 ` sgk at troutmask dot apl.washington.edu
                   ` (20 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-01-09  9:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> 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?


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (2 preceding siblings ...)
  2014-01-09  9:27 ` dominiq at lps dot ens.fr
@ 2014-01-09 15:39 ` sgk at troutmask dot apl.washington.edu
  2014-01-09 15:44 ` sgk at troutmask dot apl.washington.edu
                   ` (19 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2014-01-09 15:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Mon, Jan 06, 2014 at 11:29:42PM +0000, sgk at troutmask dot
apl.washington.edu wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59700
> 
> --- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
> The attached patch fixes the code in comment #1.  I'm currently
> doing the regtest.
> 

Updated patch.


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (3 preceding siblings ...)
  2014-01-09 15:39 ` sgk at troutmask dot apl.washington.edu
@ 2014-01-09 15:44 ` sgk at troutmask dot apl.washington.edu
  2014-01-09 20:41 ` dominiq at lps dot ens.fr
                   ` (18 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2014-01-09 15:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
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 <dominiq at lps dot ens.fr> ---
> > 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


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (4 preceding siblings ...)
  2014-01-09 15:44 ` sgk at troutmask dot apl.washington.edu
@ 2014-01-09 20:41 ` dominiq at lps dot ens.fr
  2014-01-09 20:58 ` dominiq at lps dot ens.fr
                   ` (17 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-01-09 20:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> I've started to write a testcase, but the counting of items is
> still wrong.  Look for the XXX comment in the following code.
> ...

Confirmed. Replacing the 'call abort' with 'print *, msg', 4.7.4 (r206161)
gives

[Book15] f90/bug% /opt/gcc/gcc4.7c/bin/gfortran pr59700_1_db.f90
[Book15] f90/bug% a.out
 Bad logical value while reading item 0                                         
[Book15]

So the problem with logical seems older than r203086 (at least as old as
4.4.7).

AFAICT there is no coverage of these errors in the test suite.


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (5 preceding siblings ...)
  2014-01-09 20:41 ` dominiq at lps dot ens.fr
@ 2014-01-09 20:58 ` dominiq at lps dot ens.fr
  2014-01-09 21:09 ` sgk at troutmask dot apl.washington.edu
                   ` (16 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-01-09 20:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Do you understand the '++' in

642      dtp->u.p.line_buffer[dtp->u.p.item_count++] = c;

?

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, b, c

   open(unit=fd, status='scratch')
   write(fd, '(A)') '1,.true.,2.5,q'

   i1 = 0
   a = .false.
   x1 = 0.0
   rewind(fd)
   msg = 'ok'
   read(fd, *, err=5, iomsg=msg) i1, a, x1, b
5  if (msg /= 'Bad logical value while reading item 4') print *, msg
   print *, i1, a, x1

   rewind(fd)
   write(fd, '(A)') '1 .true. .false. q'

   i1 = 0
   a = .false.
   b = .true.
   rewind(fd)
   msg = 'ok'
   read(fd, *, err=15, iomsg=msg) i1, a, b, c
15 if (msg /= 'Bad logical value while reading item 4') print *, msg
   print *, i1, a, b

   close(fd)

end program foo

gives

 Bad logical value while reading item 3                                         
           1 T   2.50000000    
 Bad logical value while reading item 2                                         
           1 T F


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (6 preceding siblings ...)
  2014-01-09 20:58 ` dominiq at lps dot ens.fr
@ 2014-01-09 21:09 ` sgk at troutmask dot apl.washington.edu
  2014-01-09 21:27 ` dominiq at lps dot ens.fr
                   ` (15 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2014-01-09 21:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Thu, Jan 09, 2014 at 08:45:19PM +0000, dominiq at lps dot ens.fr wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59700
> 
> --- Comment #8 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Do you understand the '++' in
> 
> 642      dtp->u.p.line_buffer[dtp->u.p.item_count++] = c;
> 
> ?

It's C post-increment operator.  If you had a->b[i++] = c and i = 2,
then you are setting a->b[2] = c and afterwards doing i = i + 1 = 3.

PS: Yes, I noticed that the testsuite has no tests for these
runtime errors.


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (7 preceding siblings ...)
  2014-01-09 21:09 ` sgk at troutmask dot apl.washington.edu
@ 2014-01-09 21:27 ` dominiq at lps dot ens.fr
  2014-01-09 21:39 ` sgk at troutmask dot apl.washington.edu
                   ` (14 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-01-09 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> > Do you understand the '++' in
> > 
> > 642      dtp->u.p.line_buffer[dtp->u.p.item_count++] = c;
> > 
> > ?
>
> It's C post-increment operator. ...

The question was not about the syntax, but about the functionality: i.e., I
expect dtp->u.p.item_count to be incremented when an item has been processed,
but not at the above point.


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (8 preceding siblings ...)
  2014-01-09 21:27 ` dominiq at lps dot ens.fr
@ 2014-01-09 21:39 ` sgk at troutmask dot apl.washington.edu
  2014-01-09 22:48 ` dominiq at lps dot ens.fr
                   ` (13 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2014-01-09 21:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Thu, Jan 09, 2014 at 09:27:03PM +0000, dominiq at lps dot ens.fr wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59700
> 
> --- Comment #10 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> > > Do you understand the '++' in
> > > 
> > > 642      dtp->u.p.line_buffer[dtp->u.p.item_count++] = c;
> > > 
> > > ?
> >
> > It's C post-increment operator. ...
> 
> The question was not about the syntax, but about the functionality: i.e., I
> expect dtp->u.p.item_count to be incremented when an item has been processed,
> but not at the above point.
> 

Oh.  I haven't looked at the code that closely.  This is certainly
a possible source of the issue with the improper counting.


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (9 preceding siblings ...)
  2014-01-09 21:39 ` sgk at troutmask dot apl.washington.edu
@ 2014-01-09 22:48 ` dominiq at lps dot ens.fr
  2014-01-10  4:18 ` jvdelisle at gcc dot gnu.org
                   ` (12 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-01-09 22:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
With the second patch there is a regression for gfortran.dg/namelist_46.f90.
This seems to be fixed with the following change:

@@ -757,14 +757,16 @@ read_logical (st_parameter_dt *dtp, int 

  bad_logical:

-  free_line (dtp);
-
   if (nml_bad_return (dtp, c))
-    return;
+    {
+      free_line (dtp);
+      return;
+    }

   free_saved (dtp);
   if (c == EOF)
     {
+      free_line (dtp);
       hit_eof (dtp);
       return;
     }

Only checked with

make -k check-gfortran RUNTESTFLAGS="dg.exp=namelist_46.f90
--target_board=unix'{-m32,-m64}'"


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (10 preceding siblings ...)
  2014-01-09 22:48 ` dominiq at lps dot ens.fr
@ 2014-01-10  4:18 ` jvdelisle at gcc dot gnu.org
  2014-01-10 17:09 ` jvdelisle at gcc dot gnu.org
                   ` (11 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-01-10  4:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #13 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
I will try to look at this this weekend.


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (11 preceding siblings ...)
  2014-01-10  4:18 ` jvdelisle at gcc dot gnu.org
@ 2014-01-10 17:09 ` jvdelisle at gcc dot gnu.org
  2014-01-10 22:29 ` dominiq at lps dot ens.fr
                   ` (10 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-01-10 17:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
The item_count variable serves two purposes.  This was done because we were
trying to preserve dtp space and ABI compatibility. I dont remember all the
details of why.  At any rate, when reading logicals we have to scan ahead to
confirm a valid read, so we created the infamous line_buffer.  The variable
item_count related to the line_buffer is just a pointer into the line_buffer,
it contains the current position in that scan ahead process.  The error
messages just need to change and not refer to the item in the read list.
Instead, they should refer to the location in the line where the error
occurred.

642      dtp->u.p.line_buffer[dtp->u.p.item_count++] = c;

is simply getting the next character in the line.  We probably could have used
some sort of substructure union like u.p.uu.place and u.p.uu.item_count to
avoid the confusion. Unrelated to this PR.


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (12 preceding siblings ...)
  2014-01-10 17:09 ` jvdelisle at gcc dot gnu.org
@ 2014-01-10 22:29 ` dominiq at lps dot ens.fr
  2014-01-10 22:39 ` jvdelisle at gcc dot gnu.org
                   ` (9 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-01-10 22:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
I agree with Jerry that the errors with logical can be fixed later (AFAICT they
are not a regression up to 4.3.1).

I also think the error

   read(fd, *, err=31, iomsg=msg) i1, x2, a, x1
31 if (msg /= 'Bad repeat count in item 3 of list input') call abort

is bogus (IIRC repeat count needs a '*').


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (13 preceding siblings ...)
  2014-01-10 22:29 ` dominiq at lps dot ens.fr
@ 2014-01-10 22:39 ` jvdelisle at gcc dot gnu.org
  2014-01-10 23:11 ` sgk at troutmask dot apl.washington.edu
                   ` (8 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-01-10 22:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Created attachment 31808
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31808&action=edit
Patch for PR59700 and 59764 combined

With my patch to pr59764 combined with the patches here, fixes the
read_logicals error message issue.

I will attach the whole "enchilada" here


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (14 preceding siblings ...)
  2014-01-10 22:39 ` jvdelisle at gcc dot gnu.org
@ 2014-01-10 23:11 ` sgk at troutmask dot apl.washington.edu
  2014-01-11  0:55 ` dominiq at lps dot ens.fr
                   ` (7 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2014-01-10 23:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #18 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Fri, Jan 10, 2014 at 10:29:24PM +0000, dominiq at lps dot ens.fr wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59700
> 
> --- Comment #16 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> I agree with Jerry that the errors with logical can be fixed later (AFAICT they
> are not a regression up to 4.3.1).
> 
> I also think the error
> 
>    read(fd, *, err=31, iomsg=msg) i1, x2, a, x1
> 31 if (msg /= 'Bad repeat count in item 3 of list input') call abort
> 
> is bogus (IIRC repeat count needs a '*').
> 

I think that this error message may be ok.  The 
string was something like '1 2 3.4 g'.  parse_logical
sees the initial 3 and looks for something like 3*T
or 3*.true.  The value 3.4 is an invalid repeat count,
when it hits the . during the parsing it generates an
error.


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (15 preceding siblings ...)
  2014-01-10 23:11 ` sgk at troutmask dot apl.washington.edu
@ 2014-01-11  0:55 ` dominiq at lps dot ens.fr
  2014-01-11 18:57 ` jvdelisle at gcc dot gnu.org
                   ` (6 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-01-11  0:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Regtested with the patch in comment 17 without failures. Not that an additional

   rewind(fd)
   msg = 'ok'

is needed before

   read(fd, *, err=31, iomsg=msg) i1, x2, a, x1
31 if (msg /= 'Bad repeat count in item 3 of list input') call abort

for the test in comment 6 and it succeeds with this change after the patch.

Thanks Steve and Jerry.


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (16 preceding siblings ...)
  2014-01-11  0:55 ` dominiq at lps dot ens.fr
@ 2014-01-11 18:57 ` jvdelisle at gcc dot gnu.org
  2014-01-11 21:39 ` jvdelisle at gcc dot gnu.org
                   ` (5 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-01-11 18:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Author: jvdelisle
Date: Sat Jan 11 18:57:20 2014
New Revision: 206553

URL: http://gcc.gnu.org/viewcvs?rev=206553&root=gcc&view=rev
Log:
2014-01-11  Jerry DeLisle  <jvdelisle@gcc.gnu>
        Dominique d'Humieres  <dominiq@lps.ens.fr>
        Steven G. Kargl  <kargl@gcc.gnu.org>

    PR libfortran/59700
    PR libfortran/59764
    * io/io.h (struct st_parameter_dt): Assign expanded_read flag to
    unused bit. Define new variable line_buffer_pos.
    * io/list_read.c (free_saved, next_char, l_push_char,
    read_logical, read_real): Replace use of item_count with
    line_buffer_pos for line_buffer look ahead.
    (read_logical, read_integer, parse_real, read_real, check_type):
    Adjust location of free_line to after generating error messages
    to retain the correct item count for the message.

Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/io.h
    trunk/libgfortran/io/list_read.c


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (17 preceding siblings ...)
  2014-01-11 18:57 ` jvdelisle at gcc dot gnu.org
@ 2014-01-11 21:39 ` jvdelisle at gcc dot gnu.org
  2014-02-22  0:02 ` jvdelisle at gcc dot gnu.org
                   ` (4 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-01-11 21:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #21 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Author: jvdelisle
Date: Sat Jan 11 21:38:30 2014
New Revision: 206559

URL: http://gcc.gnu.org/viewcvs?rev=206559&root=gcc&view=rev
Log:
2014-01-11  Steven G. Kargl  <kargl@gcc.gnu.org>

    PR fortran/59700
    * gfortran.dg/pr59700.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/pr59700.f90
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (18 preceding siblings ...)
  2014-01-11 21:39 ` jvdelisle at gcc dot gnu.org
@ 2014-02-22  0:02 ` jvdelisle at gcc dot gnu.org
  2014-02-22  0:34 ` sgk at troutmask dot apl.washington.edu
                   ` (3 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-02-22  0:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #22 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Fixed on trunk. Do I need to backport this?


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (19 preceding siblings ...)
  2014-02-22  0:02 ` jvdelisle at gcc dot gnu.org
@ 2014-02-22  0:34 ` sgk at troutmask dot apl.washington.edu
  2014-02-22  2:12 ` jvdelisle at gcc dot gnu.org
                   ` (2 subsequent siblings)
  23 siblings, 0 replies; 25+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2014-02-22  0:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #23 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Sat, Feb 22, 2014 at 12:02:38AM +0000, jvdelisle at gcc dot gnu.org wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59700
> 
> --- Comment #22 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
> Fixed on trunk. Do I need to backport this?
> 

IMHO, No.


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (20 preceding siblings ...)
  2014-02-22  0:34 ` sgk at troutmask dot apl.washington.edu
@ 2014-02-22  2:12 ` jvdelisle at gcc dot gnu.org
  2014-02-22  2:51 ` jvdelisle at gcc dot gnu.org
  2014-02-22  2:53 ` jvdelisle at gcc dot gnu.org
  23 siblings, 0 replies; 25+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-02-22  2:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #24 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Author: jvdelisle
Date: Sat Feb 22 02:11:44 2014
New Revision: 208038

URL: http://gcc.gnu.org/viewcvs?rev=208038&root=gcc&view=rev
Log:
2014-02-21  Jerry DeLisle  <jvdelisle@gcc.gnu>
        Dominique d'Humieres  <dominiq@lps.ens.fr>
        Steven G. Kargl  <kargl@gcc.gnu.org>

    Backport from mainline
    PR libfortran/59700
    PR libfortran/59764
    * io/io.h (struct st_parameter_dt): Assign expanded_read flag to
    unused bit. Define new variable line_buffer_pos.
    * io/list_read.c (free_saved, next_char, l_push_char,
    read_logical, read_real): Replace use of item_count with
    line_buffer_pos for line_buffer look ahead.
    (read_logical, read_integer, parse_real, read_real, check_type):
    Adjust location of free_line to after generating error messages
    to retain the correct item count for the message. 

Modified:
    branches/gcc-4_8-branch/libgfortran/ChangeLog
    branches/gcc-4_8-branch/libgfortran/io/io.h
    branches/gcc-4_8-branch/libgfortran/io/list_read.c


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (21 preceding siblings ...)
  2014-02-22  2:12 ` jvdelisle at gcc dot gnu.org
@ 2014-02-22  2:51 ` jvdelisle at gcc dot gnu.org
  2014-02-22  2:53 ` jvdelisle at gcc dot gnu.org
  23 siblings, 0 replies; 25+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-02-22  2:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #25 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Author: jvdelisle
Date: Sat Feb 22 02:50:39 2014
New Revision: 208039

URL: http://gcc.gnu.org/viewcvs?rev=208039&root=gcc&view=rev
Log:
2014-02-21  Steven G. Kargl  <kargl@gcc.gnu.org>

    Backport from mainline
    PR fortran/59700
    * gfortran.dg/pr59700.f90: New test.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gfortran.dg/pr59700.f90
Modified:
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/59700] [4.8/4.9 Regression] Misleading/buggy runtime error message: Bad integer for item 0 in list input
  2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
                   ` (22 preceding siblings ...)
  2014-02-22  2:51 ` jvdelisle at gcc dot gnu.org
@ 2014-02-22  2:53 ` jvdelisle at gcc dot gnu.org
  23 siblings, 0 replies; 25+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2014-02-22  2:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #26 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Fixed on 4.8. Closing


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

end of thread, other threads:[~2014-02-22  2:53 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-06 14:45 [Bug fortran/59700] New: Misleading/buggy runtime error message: Bad integer for item 0 in list input mvondomaros at gmail dot com
2014-01-06 23:24 ` [Bug fortran/59700] [4.8/4.9 Regression] " kargl at gcc dot gnu.org
2014-01-07 11:54 ` rguenth at gcc dot gnu.org
2014-01-09  9:27 ` dominiq at lps dot ens.fr
2014-01-09 15:39 ` sgk at troutmask dot apl.washington.edu
2014-01-09 15:44 ` sgk at troutmask dot apl.washington.edu
2014-01-09 20:41 ` dominiq at lps dot ens.fr
2014-01-09 20:58 ` dominiq at lps dot ens.fr
2014-01-09 21:09 ` sgk at troutmask dot apl.washington.edu
2014-01-09 21:27 ` dominiq at lps dot ens.fr
2014-01-09 21:39 ` sgk at troutmask dot apl.washington.edu
2014-01-09 22:48 ` dominiq at lps dot ens.fr
2014-01-10  4:18 ` jvdelisle at gcc dot gnu.org
2014-01-10 17:09 ` jvdelisle at gcc dot gnu.org
2014-01-10 22:29 ` dominiq at lps dot ens.fr
2014-01-10 22:39 ` jvdelisle at gcc dot gnu.org
2014-01-10 23:11 ` sgk at troutmask dot apl.washington.edu
2014-01-11  0:55 ` dominiq at lps dot ens.fr
2014-01-11 18:57 ` jvdelisle at gcc dot gnu.org
2014-01-11 21:39 ` jvdelisle at gcc dot gnu.org
2014-02-22  0:02 ` jvdelisle at gcc dot gnu.org
2014-02-22  0:34 ` sgk at troutmask dot apl.washington.edu
2014-02-22  2:12 ` jvdelisle at gcc dot gnu.org
2014-02-22  2:51 ` jvdelisle at gcc dot gnu.org
2014-02-22  2:53 ` 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).