public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/29835]  New: Error message of non-unknown edit descriptor needs improvement
@ 2006-11-14 18:01 burnus at gcc dot gnu dot org
  2006-11-14 18:01 ` [Bug fortran/29835] " burnus at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-11-14 18:01 UTC (permalink / raw)
  To: gcc-bugs

gfortran writes:
    read(1,'(Q,A)',iostat=i) n,line(:n)
                                      1
Warning: Unexpected element in format string at (1)

And if there is a long comment it may even look like:
XLINE
    1
Warning: Unexpected element in format string at (1)


Expected:
    read(1,'(Q,A)',iostat=i) n,line(:n)
             1
Warning: Unexpected element in format string at (1)
or even:
Warning: Unexpected element 'Q' in format string at (1)

(The run-time message is also slightly misaligned:
read(1,'(Q,A)') n,line(:n)
       1

---------- Test program ---------
integer, parameter :: MAXLINE = 255
character(MAXLINE) line
open(1,file='whatever', access='sequential',form='formatted',action='read')
do
   read(1,'(Q,A)',iostat=i) n,line(:n)
   if (i/=0) exit
! real work here
 enddo
end
---------- Test program ---------
Cf.
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/d968667b1e3219ab

 * * *

The Q edit descriptor is, e.g., described at
http://www.helsinki.fi/atk/unix/dec_manuals/cf77au/olrm0242.htm

It is documented but not supported in g77, seems to be a DEC extension and is
supported by ifort and sunf95.
I think, gfortran does not need to support it.


-- 
           Summary: Error message of non-unknown edit descriptor needs
                    improvement
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        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=29835


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

* [Bug fortran/29835] Error message of non-unknown edit descriptor needs improvement
  2006-11-14 18:01 [Bug fortran/29835] New: Error message of non-unknown edit descriptor needs improvement burnus at gcc dot gnu dot org
@ 2006-11-14 18:01 ` burnus at gcc dot gnu dot org
  2007-01-02  4:51 ` [Bug fortran/29835] Error message of unknown " jvdelisle at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-11-14 18:01 UTC (permalink / raw)
  To: gcc-bugs



-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-11-14 18:01:30
               date|                            |


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


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

* [Bug fortran/29835] Error message of unknown edit descriptor needs improvement
  2006-11-14 18:01 [Bug fortran/29835] New: Error message of non-unknown edit descriptor needs improvement burnus at gcc dot gnu dot org
  2006-11-14 18:01 ` [Bug fortran/29835] " burnus at gcc dot gnu dot org
@ 2007-01-02  4:51 ` jvdelisle at gcc dot gnu dot org
  2007-09-08 20:16 ` jvdelisle at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-01-02  4:51 UTC (permalink / raw)
  To: gcc-bugs



-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor


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


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

* [Bug fortran/29835] Error message of unknown edit descriptor needs improvement
  2006-11-14 18:01 [Bug fortran/29835] New: Error message of non-unknown edit descriptor needs improvement burnus at gcc dot gnu dot org
  2006-11-14 18:01 ` [Bug fortran/29835] " burnus at gcc dot gnu dot org
  2007-01-02  4:51 ` [Bug fortran/29835] Error message of unknown " jvdelisle at gcc dot gnu dot org
@ 2007-09-08 20:16 ` jvdelisle at gcc dot gnu dot org
  2008-07-22 17:07 ` domob at gcc dot gnu dot org
  2008-07-22 17:11 ` domob at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-09-08 20:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jvdelisle at gcc dot gnu dot org  2007-09-08 20:16 -------
*** Bug 33338 has been marked as a duplicate of this bug. ***


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |longb at cray dot com


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


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

* [Bug fortran/29835] Error message of unknown edit descriptor needs improvement
  2006-11-14 18:01 [Bug fortran/29835] New: Error message of non-unknown edit descriptor needs improvement burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-09-08 20:16 ` jvdelisle at gcc dot gnu dot org
@ 2008-07-22 17:07 ` domob at gcc dot gnu dot org
  2008-07-22 17:11 ` domob at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: domob at gcc dot gnu dot org @ 2008-07-22 17:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from domob at gcc dot gnu dot org  2008-07-22 17:06 -------
Subject: Bug 29835

Author: domob
Date: Tue Jul 22 17:05:55 2008
New Revision: 138063

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138063
Log:
2008-07-22  Daniel Kraft  <d@domob.eu>

        PR fortran/29835
        * io.c (error_element), (format_locus):  New static globals.
        (unexpected_element):  Spelled out this message fully.
        (next_char):  Keep track of locus when not MODE_STRING.
        (next_char_not_space):  Remember last parsed element in error_element.
        (format_lex):  Fix two indentation errors.
        (check_format):  Use format_locus and possibly error_element for a
        slightly better error message on invalid format.
        (check_format_string):  Set format_locus to start of the string
        expression used as format.

2008-07-22  Daniel Kraft  <d@domob.eu>

        PR fortran/29835
        * io/format.c (struct format_data):  New member error_element.
        (unexpected_element):  Added '%c' to message.
        (next_char):  Keep track of last parsed character in
fmt->error_element.
        (format_error):  If the message is unexpected_element, output the
        offending character, too.

2008-07-22  Daniel Kraft  <d@domob.eu>

        PR fortran/29835
        * gfortran.dg/fmt_error_3.f90:  New test.
        * gfortran.dg/fmt_error_4.f90:  New test.
        * gfortran.dg/fmt_error_5.f90:  New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/fmt_error_3.f90
    trunk/gcc/testsuite/gfortran.dg/fmt_error_4.f90
    trunk/gcc/testsuite/gfortran.dg/fmt_error_5.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/io.c
    trunk/gcc/testsuite/ChangeLog
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/format.c


-- 


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


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

* [Bug fortran/29835] Error message of unknown edit descriptor needs improvement
  2006-11-14 18:01 [Bug fortran/29835] New: Error message of non-unknown edit descriptor needs improvement burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-07-22 17:07 ` domob at gcc dot gnu dot org
@ 2008-07-22 17:11 ` domob at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: domob at gcc dot gnu dot org @ 2008-07-22 17:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from domob at gcc dot gnu dot org  2008-07-22 17:11 -------
The message locus for constant-string is not yet perfect, but the effort to
benefit ratio in this case is probably rather bad, so I mark this as fixed.

In my commit, I changed the "Unexpected element" error to include the offending
character as suggested in the opening comment, changed the locus for
constant-string expressions to the start of this expression rather than the end
of the overall statement and added some tests for both runtime and compile time
format checking.


-- 

domob at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-07-22 17:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-14 18:01 [Bug fortran/29835] New: Error message of non-unknown edit descriptor needs improvement burnus at gcc dot gnu dot org
2006-11-14 18:01 ` [Bug fortran/29835] " burnus at gcc dot gnu dot org
2007-01-02  4:51 ` [Bug fortran/29835] Error message of unknown " jvdelisle at gcc dot gnu dot org
2007-09-08 20:16 ` jvdelisle at gcc dot gnu dot org
2008-07-22 17:07 ` domob at gcc dot gnu dot org
2008-07-22 17:11 ` domob 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).