[Bug fortran/28039] Warn when ignoring extra characters in the format specification

2010-04-23 Thread jvdelisle at gcc dot gnu dot org


--- Comment #15 from jvdelisle at gcc dot gnu dot org  2010-04-24 03:05 
---
Actually close it.


-- 

jvdelisle at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



[Bug fortran/28039] Warn when ignoring extra characters in the format specification

2010-04-23 Thread jvdelisle at gcc dot gnu dot org


--- Comment #14 from jvdelisle at gcc dot gnu dot org  2010-04-24 03:04 
---
Fixed on trunk. Closing.


-- 

jvdelisle at gcc dot gnu dot org changed:

   What|Removed |Added

   Target Milestone|--- |4.6.0


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



[Bug fortran/28039] Warn when ignoring extra characters in the format specification

2010-04-08 Thread jvdelisle at gcc dot gnu dot org


--- Comment #13 from jvdelisle at gcc dot gnu dot org  2010-04-09 03:25 
---
Subject: Bug 28039

Author: jvdelisle
Date: Fri Apr  9 03:25:09 2010
New Revision: 158148

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158148
Log:
2010-04-08  Bud Davis  

PR fortran/28039
* gfortran.dg/fmt_with_extra.f: Remove xfail and update test.

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/fmt_with_extra.f


-- 


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



[Bug fortran/28039] Warn when ignoring extra characters in the format specification

2010-04-08 Thread jvdelisle at gcc dot gnu dot org


--- Comment #12 from jvdelisle at gcc dot gnu dot org  2010-04-09 02:03 
---
Subject: Bug 28039

Author: jvdelisle
Date: Fri Apr  9 02:03:10 2010
New Revision: 158147

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158147
Log:
2010-04-08  Bud Davis  

PR fortran/28039
* io.c (check_format_string):  Added check for additional non 
blank characters after the format string was successfully 
parsed.
* io.c (check_format): Changed the error messages for positive
int required and period required to drop through the error logic
and report with gfc_error instead of gfc_error_now.  Corrected
format postion for hollerith strings.

Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/io.c


-- 


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



[Bug fortran/28039] Warn when ignoring extra characters in the format specification

2009-12-29 Thread bdavis at gcc dot gnu dot org


--- Comment #11 from bdavis at gcc dot gnu dot org  2009-12-30 05:23 ---
http://gcc.gnu.org/ml/gcc-patches/2009-12/msg01200.html


-- 


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



[Bug fortran/28039] Warn when ignoring extra characters in the format specification

2009-12-29 Thread bdavis at gcc dot gnu dot org


--- Comment #10 from bdavis at gcc dot gnu dot org  2009-12-30 04:25 ---
let's give this a try:

Index: gcc/gcc/testsuite/gfortran.dg/fmt_with_extra.f
===
--- gcc/gcc/testsuite/gfortran.dg/fmt_with_extra.f  (revision 155511)
+++ gcc/gcc/testsuite/gfortran.dg/fmt_with_extra.f  (working copy)
@@ -4,5 +4,25 @@
implicit none
real :: r
r = 1.0
-   write(*,'(a),f)') 'Hello', r   ! { dg-warning "Extraneous characters in
format at" "PR28039" { xfail *-*-* } }
+   write(*,'(a),f)') 'Hello', r   ! { dg-warning "Extraneous characters in
format at" }
end
+! Below routine was also submitted by tobias.bur...@physik.fu-berlin.de
+! It showed up some problems with the initial implementation of this
+! feature.
+! This routine should compile without complaint or warning.
+  SUBROUTINE rw_inp()
+  CHARACTER(len=100) :: line
+  integer :: i5
+  character(100), parameter :: subchapter =
+ &'(79("-"),/,5("-")," ",A,/,79("-"),/)'
+  i5 = 1
+
+  READ(*,FMT="(4x,a)") line
+ 7182 FORMAT (a3)
+ 7130 FORMAT (i3)
+
+  WRITE (6,'(//'' icorr is not correctly transferred.  icorr='',i5)
+ &') 42
+
+  write(*,subchapter) 'test'
+  END SUBROUTINE rw_inp
Index: gcc/gcc/fortran/io.c
===
--- gcc/gcc/fortran/io.c(revision 155511)
+++ gcc/gcc/fortran/io.c(working copy)
@@ -850,11 +850,11 @@
   if (u != FMT_POSINT)
{
  format_locus.nextc += format_string_pos;
- gfc_error_now ("Positive width required in format "
+ gfc_error ("Positive width required in format "
 "specifier %s at %L", token_to_string (t),
 &format_locus);
  saved_token = u;
- goto finished;
+ goto fail;
}

   u = format_lex ();
@@ -866,11 +866,11 @@
  format_locus.nextc += format_string_pos;
  if (gfc_option.warn_std != 0)
{
- gfc_error_now ("Period required in format "
+ gfc_error ("Period required in format "
 "specifier %s at %L", token_to_string (t),
 &format_locus);
  saved_token = u;
- goto finished;
+  goto fail;
}
  else
gfc_warning ("Period required in format "
@@ -970,11 +970,11 @@
  gfc_warning ("The H format specifier at %L is"
   " a Fortran 95 deleted feature", &format_locus);
}
-
   if (mode == MODE_STRING)
{
  format_string += value;
  format_length -= value;
+  format_string_pos += repeat;
}
   else
{
@@ -1152,6 +1152,8 @@
 static gfc_try
 check_format_string (gfc_expr *e, bool is_input)
 {
+  gfc_try rv;
+  int i;
   if (!e || e->ts.type != BT_CHARACTER || e->expr_type != EXPR_CONSTANT)
 return SUCCESS;

@@ -1162,8 +1164,20 @@
  format string that has been calculated, but that's probably not worth the
  effort.  */
   format_locus = e->where;
-
-  return check_format (is_input);
+  rv = check_format (is_input);
+  /* check for extraneous characters at the end of an otherwise valid format
+ string, like '(A10,I3)F5'
+ start at the end and move back to the last character processed,
+ spaces are OK */
+  if (rv == SUCCESS && e->value.character.length > format_string_pos)
+for (i=e->value.character.length-1;i>format_string_pos-1;i--)
+  if (e->value.character.string[i] != ' ')
+{
+  format_locus.nextc += format_length + 1; 
+  gfc_warning ("Extraneous characters in format at %L",
&format_locus); 
+  break;
+}
+  return rv;
 }


will submit an official patch after doing regtesting against a clean tree.
since we are 'stabilizing' for 4.5, it might be a while for this is committed
so i am posting it here so the work is not lost.


--bud


-- 

bdavis at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|REOPENED|ASSIGNED
   Last reconfirmed|2009-08-22 23:21:18 |2009-12-30 04:25:49
   date||


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



[Bug fortran/28039] Warn when ignoring extra characters in the format specification

2009-08-27 Thread burnus at gcc dot gnu dot org


--- Comment #9 from burnus at gcc dot gnu dot org  2009-08-27 12:11 ---
Test case of valid but previously failing code (which I forgot to include in
fmt_with_extra.f when xfailing it):


  SUBROUTINE rw_inp()
  CHARACTER(len=100) :: line
  integer :: i5
  character(100), parameter :: subchapter = 
 &'(79("-"),/,5("-")," ",A,/,79("-"),/)'
  i5 = 1

  READ(*,FMT="(4x,a)") line
 7182 FORMAT (a3)
 7130 FORMAT (i3)

  WRITE (6,'(//'' icorr is not correctly transferred. icorr='',i5)
 &') 42

  write(*,subchapter) 'test'
  END SUBROUTINE rw_inp


The last item has the additional problem that the cursor position points to the
expanded string and not to the parameter. That's probably a general problem;
(the string could also be  'string'//parameter   which should also be treated
better.)

write(*,subchapter) 'test'
 1
Warning: Extraneous characters in format at (1)

This presumably should be handled in a different PR.


-- 


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



[Bug fortran/28039] Warn when ignoring extra characters in the format specification

2009-08-27 Thread burnus at gcc dot gnu dot org


--- Comment #8 from burnus at gcc dot gnu dot org  2009-08-27 12:00 ---
Subject: Bug 28039

Author: burnus
Date: Thu Aug 27 11:59:51 2009
New Revision: 151141

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151141
Log:
2009-08-27  Tobias Burnus  

PR fortran/28039
* gfortran.dg/fmt_with_extra.f: xfail testcase as patch was
* reverted.


Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/fmt_with_extra.f


-- 


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



[Bug fortran/28039] Warn when ignoring extra characters in the format specification

2009-08-26 Thread burnus at gcc dot gnu dot org


--- Comment #7 from burnus at gcc dot gnu dot org  2009-08-27 06:29 ---
As the patch was reverted, re-open the PR. Remember to include the example of
PR 41152 when submitting the next patch.


-- 

burnus at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |


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



[Bug fortran/28039] Warn when ignoring extra characters in the format specification

2009-08-26 Thread hp at gcc dot gnu dot org


--- Comment #6 from hp at gcc dot gnu dot org  2009-08-26 23:09 ---
I see the patch for this PR has been reverted.  Please also remove the
test-case, or xfail it until a fix is committed, as it's now technically a
regression (at least my autotester thinks so). Don't forget that you must also
CC gcc-patches@ not just fortran@ on your patches, this wasn't done.


-- 


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



[Bug fortran/28039] Warn when ignoring extra characters in the format specification

2009-08-24 Thread burnus at gcc dot gnu dot org


--- Comment #5 from burnus at gcc dot gnu dot org  2009-08-24 08:53 ---
Thanks for the fix, however, it causes some bogus diagnostic - see PR 41152


-- 


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



[Bug fortran/28039] Warn when ignoring extra characters in the format specification

2009-08-22 Thread bdavis at gcc dot gnu dot org


--- Comment #4 from bdavis at gcc dot gnu dot org  2009-08-23 02:27 ---
http://gcc.gnu.org/ml/fortran/2009-08/msg00324.html


-- 

bdavis at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



[Bug fortran/28039] Warn when ignoring extra characters in the format specification

2009-08-22 Thread bdavis at gcc dot gnu dot org


--- Comment #3 from bdavis at gcc dot gnu dot org  2009-08-23 02:20 ---
Subject: Bug 28039

Author: bdavis
Date: Sun Aug 23 02:19:59 2009
New Revision: 151021

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151021
Log:
2009-08-22  Bud Davis 

PR fortran/28093
* io.c : added variable to store original len of fmt
* io.c (check_format): Consume H items using next_char
in both modes to handle consecutive single quotes.
Test for extra characters in fmt, issue warning.

2009-08-22  Bud Davis  

PR fortran/28039
* gfortran.dg/fmt_with_extra.f: new file.



Added:
trunk/gcc/testsuite/gfortran.dg/fmt_with_extra.f
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/io.c
trunk/gcc/testsuite/ChangeLog


-- 


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



[Bug fortran/28039] Warn when ignoring extra characters in the format specification

2009-08-22 Thread bdavis at gcc dot gnu dot org


--- Comment #2 from bdavis at gcc dot gnu dot org  2009-08-22 23:21 ---
http://gcc.gnu.org/ml/fortran/2009-08/msg00324.html


-- 

bdavis at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |bdavis at gcc dot gnu dot
   |dot org |org
 Status|NEW |ASSIGNED
   Last reconfirmed|2006-06-20 10:59:45 |2009-08-22 23:21:18
   date||


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



[Bug fortran/28039] Warn when ignoring extra characters in the format specification

2006-06-20 Thread fxcoudert at gcc dot gnu dot org


--- Comment #1 from fxcoudert at gcc dot gnu dot org  2006-06-20 10:59 
---
Confirmed.


-- 

fxcoudert at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Keywords||diagnostic
  Known to fail||4.2.0 4.1.2
   Last reconfirmed|-00-00 00:00:00 |2006-06-20 10:59:45
   date||


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