public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/38404]  New: Warning message identifies incorrect line
@ 2008-12-04 17:04 steve dot chapel at a2pg dot com
  2009-03-28 12:20 ` [Bug fortran/38404] " fxcoudert at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: steve dot chapel at a2pg dot com @ 2008-12-04 17:04 UTC (permalink / raw)
  To: gcc-bugs

When the following program (truncbug.f) is compiled with gfortran 4.3.2:

      SUBROUTINE ERRMSG(N,STRING,LST)
      CHARACTER*72 TEXT(2)
      DATA (TEXT(I),I=1,2)/
     X'MUST BE "CALL SIMEPS(EPS)"',
     X'"R" IN CALL RANDOM MAY NOT BE USED OUTSIDE THE BLOCK CONTAINING T
     XHE CALL.'/
      END

This warning message results:

truncbug.f:4.72:

     X'MUST BE "CALL SIMEPS(EPS)"',                                     
                                                                       1
Warning: initialization string truncated to match variable at (1)

This is two lines before the line that the string truncation occurs on.
Ideally, gfortran should put the (1) mark at the character in the string where
the truncation occurs.


-- 
           Summary: Warning message identifies incorrect line
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: steve dot chapel at a2pg dot com
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


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


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

* [Bug fortran/38404] Warning message identifies incorrect line
  2008-12-04 17:04 [Bug fortran/38404] New: Warning message identifies incorrect line steve dot chapel at a2pg dot com
@ 2009-03-28 12:20 ` fxcoudert at gcc dot gnu dot org
  2010-05-13 12:30 ` dfranke at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-03-28 12:20 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|i386-redhat-linux           |
   GCC host triplet|i386-redhat-linux           |
 GCC target triplet|i386-redhat-linux           |
   Last reconfirmed|0000-00-00 00:00:00         |2009-03-28 12:20:08
               date|                            |


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


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

* [Bug fortran/38404] Warning message identifies incorrect line
  2008-12-04 17:04 [Bug fortran/38404] New: Warning message identifies incorrect line steve dot chapel at a2pg dot com
  2009-03-28 12:20 ` [Bug fortran/38404] " fxcoudert at gcc dot gnu dot org
@ 2010-05-13 12:30 ` dfranke at gcc dot gnu dot org
  2010-05-13 13:15 ` steve dot chapel at a2pg dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-13 12:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dfranke at gcc dot gnu dot org  2010-05-13 12:30 -------
Suggested patch:
    http://gcc.gnu.org/ml/fortran/2010-05/msg00116.html


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |dfranke at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-03-28 12:20:08         |2010-05-13 12:30:31
               date|                            |


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


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

* [Bug fortran/38404] Warning message identifies incorrect line
  2008-12-04 17:04 [Bug fortran/38404] New: Warning message identifies incorrect line steve dot chapel at a2pg dot com
  2009-03-28 12:20 ` [Bug fortran/38404] " fxcoudert at gcc dot gnu dot org
  2010-05-13 12:30 ` dfranke at gcc dot gnu dot org
@ 2010-05-13 13:15 ` steve dot chapel at a2pg dot com
  2010-05-13 13:26 ` dfranke at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: steve dot chapel at a2pg dot com @ 2010-05-13 13:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from steve dot chapel at a2pg dot com  2010-05-13 13:15 -------
Excellent! The new warning is far more understandable than the old.

     X'"R" IN CALL RANDOM MAY NOT BE USED OUTSIDE THE BLOCK CONTAINING T
       1
Warning: Initialization string starting at (1) was truncated after 72 
characters to match the variable

If it's difficult to place the error marker at the location the string was
truncated, would it be easy to list the number of characters in the
initialization string, so that one would not have to count characters to
determine how many characters need to be removed, or how much larger to make
the variable?

Example:

     X'"R" IN CALL RANDOM MAY NOT BE USED OUTSIDE THE BLOCK CONTAINING T
       1
Warning: Initialization string of 73 characters starting at (1) was
truncated after 72 characters to match the variable


-- 


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


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

* [Bug fortran/38404] Warning message identifies incorrect line
  2008-12-04 17:04 [Bug fortran/38404] New: Warning message identifies incorrect line steve dot chapel at a2pg dot com
                   ` (2 preceding siblings ...)
  2010-05-13 13:15 ` steve dot chapel at a2pg dot com
@ 2010-05-13 13:26 ` dfranke at gcc dot gnu dot org
  2010-05-13 16:28 ` steve dot chapel at a2pg dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-13 13:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dfranke at gcc dot gnu dot org  2010-05-13 13:26 -------
That's easily doable. Alternative patch for data.c below gives:

$ gfortran-svn pr38404.f 
pr38404.f:5.7:

     X'"R" IN CALL RANDOM MAY NOT BE USED OUTSIDE THE BLOCK CONTAINING T
       1
Warning: Initialization string starting at (1) was truncated to fit the
variable (73/72)

(Modified the message to be similar to many other actual-size/expected-size
outputs)


Index: data.c
===================================================================
--- data.c      (revision 159348)
+++ data.c      (working copy)
@@ -154,9 +154,10 @@ create_character_intializer (gfc_expr *i

   if (len > end - start)
     {
+      gfc_warning_now ("Initialization string starting at %L was "
+                      "truncated to fit the variable (%d/%d)",
+                      &rvalue->where, len, end - start);
       len = end - start;
-      gfc_warning_now ("initialization string truncated to match variable "
-                      "at %L", &rvalue->where);
     }

   if (rvalue->ts.type == BT_HOLLERITH)


-- 


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


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

* [Bug fortran/38404] Warning message identifies incorrect line
  2008-12-04 17:04 [Bug fortran/38404] New: Warning message identifies incorrect line steve dot chapel at a2pg dot com
                   ` (3 preceding siblings ...)
  2010-05-13 13:26 ` dfranke at gcc dot gnu dot org
@ 2010-05-13 16:28 ` steve dot chapel at a2pg dot com
  2010-05-19 12:55 ` dfranke at gcc dot gnu dot org
  2010-05-19 12:57 ` dfranke at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: steve dot chapel at a2pg dot com @ 2010-05-13 16:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from steve dot chapel at a2pg dot com  2010-05-13 16:28 -------
:)


-- 


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


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

* [Bug fortran/38404] Warning message identifies incorrect line
  2008-12-04 17:04 [Bug fortran/38404] New: Warning message identifies incorrect line steve dot chapel at a2pg dot com
                   ` (4 preceding siblings ...)
  2010-05-13 16:28 ` steve dot chapel at a2pg dot com
@ 2010-05-19 12:55 ` dfranke at gcc dot gnu dot org
  2010-05-19 12:57 ` dfranke at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-19 12:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from dfranke at gcc dot gnu dot org  2010-05-19 12:55 -------
Subject: Bug 38404

Author: dfranke
Date: Wed May 19 12:55:26 2010
New Revision: 159561

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159561
Log:
gcc/fortran/:
2010-05-19  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/38404
        * primary.c (match_string_constant): Move start_locus just inside 
        the string.
        * data.c (create_character_intializer): Clarified truncation warning.

gcc/testsuite/:
2010-05-19  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/38404
        * gfortran.dg/data_char_1.f90: Updated warning message.
        * gfortran.dg/data_array_6.f: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/data_array_6.f
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/data.c
    trunk/gcc/fortran/primary.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/data_char_1.f90


-- 


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


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

* [Bug fortran/38404] Warning message identifies incorrect line
  2008-12-04 17:04 [Bug fortran/38404] New: Warning message identifies incorrect line steve dot chapel at a2pg dot com
                   ` (5 preceding siblings ...)
  2010-05-19 12:55 ` dfranke at gcc dot gnu dot org
@ 2010-05-19 12:57 ` dfranke at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-19 12:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from dfranke at gcc dot gnu dot org  2010-05-19 12:56 -------
Fixed in trunk. Closing.
Thanks for the report!


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.6.0


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


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

end of thread, other threads:[~2010-05-19 12:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-04 17:04 [Bug fortran/38404] New: Warning message identifies incorrect line steve dot chapel at a2pg dot com
2009-03-28 12:20 ` [Bug fortran/38404] " fxcoudert at gcc dot gnu dot org
2010-05-13 12:30 ` dfranke at gcc dot gnu dot org
2010-05-13 13:15 ` steve dot chapel at a2pg dot com
2010-05-13 13:26 ` dfranke at gcc dot gnu dot org
2010-05-13 16:28 ` steve dot chapel at a2pg dot com
2010-05-19 12:55 ` dfranke at gcc dot gnu dot org
2010-05-19 12:57 ` dfranke 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).