* [Bug fortran/32987] GFortran FORMAT statement error
2007-08-04 13:55 [Bug fortran/32987] New: GFortran FORMAT statement error satyaakam at yahoo dot co dot in
@ 2007-08-04 13:56 ` satyaakam at yahoo dot co dot in
2007-08-04 15:56 ` kargl at gcc dot gnu dot org
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: satyaakam at yahoo dot co dot in @ 2007-08-04 13:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from satyaakam at yahoo dot co dot in 2007-08-04 13:56 -------
Created an attachment (id=14021)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14021&action=view)
testcase
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32987
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/32987] GFortran FORMAT statement error
2007-08-04 13:55 [Bug fortran/32987] New: GFortran FORMAT statement error satyaakam at yahoo dot co dot in
2007-08-04 13:56 ` [Bug fortran/32987] " satyaakam at yahoo dot co dot in
@ 2007-08-04 15:56 ` kargl at gcc dot gnu dot org
2007-08-04 16:26 ` kargl at gcc dot gnu dot org
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: kargl at gcc dot gnu dot org @ 2007-08-04 15:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from kargl at gcc dot gnu dot org 2007-08-04 15:56 -------
Fix your code. A tab is not a legal substitution for a space
character.
--
kargl at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32987
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/32987] GFortran FORMAT statement error
2007-08-04 13:55 [Bug fortran/32987] New: GFortran FORMAT statement error satyaakam at yahoo dot co dot in
2007-08-04 13:56 ` [Bug fortran/32987] " satyaakam at yahoo dot co dot in
2007-08-04 15:56 ` kargl at gcc dot gnu dot org
@ 2007-08-04 16:26 ` kargl at gcc dot gnu dot org
2007-08-04 16:53 ` [Bug fortran/32987] TAB in FORMAT: accept extension, warn with -std=f* burnus at gcc dot gnu dot org
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: kargl at gcc dot gnu dot org @ 2007-08-04 16:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from kargl at gcc dot gnu dot org 2007-08-04 16:26 -------
Here's a patch that permits gfortran to accept your INVALID code.
Your code should be fixed, and I will activity oppose application
of this patch by others.
Index: format.c
===================================================================
--- format.c (revision 127165)
+++ format.c (working copy)
@@ -92,7 +92,7 @@
fmt->format_string_len--;
c = toupper (*fmt->format_string++);
}
- while (c == ' ' && !literal);
+ while ((c == ' ' || c == '\t') && !literal);
return c;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32987
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/32987] TAB in FORMAT: accept extension, warn with -std=f*
2007-08-04 13:55 [Bug fortran/32987] New: GFortran FORMAT statement error satyaakam at yahoo dot co dot in
` (2 preceding siblings ...)
2007-08-04 16:26 ` kargl at gcc dot gnu dot org
@ 2007-08-04 16:53 ` burnus at gcc dot gnu dot org
2007-08-04 17:00 ` sgk at troutmask dot apl dot washington dot edu
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-04 16:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from burnus at gcc dot gnu dot org 2007-08-04 16:53 -------
I just checked: ifort, sunf95, openf95, g95 and even the picky NAG f95 accept
it. None of the compilers gives a warning except of "ifort" when passing the
option "-stand 95":
fortcom: Warning: format_with_tab.f, line 3: Extension to FORTRAN-90: tab
formatting
10 format ('Hello ', 'bug!')
------------------------^
I therefore suggest:
- Silently accept the tab in libgfortran
- Give a warning or an error with -std=f95/f2003.
Index: gcc/fortran/io.c
===================================================================
--- gcc/fortran/io.c (revision 127204)
+++ gcc/fortran/io.c (working copy)
@@ -183,0 +184,2 @@ next_char_not_space (void)
+ if (c == '\t' && !(gfc_option.allow_std & GFC_STD_GNU))
+ gfc_warning ("Extension: Tab character in format at %C");
Index: libgfortran/io/format.c
===================================================================
--- libgfortran/io/format.c (revision 127204)
+++ libgfortran/io/format.c (working copy)
@@ -95 +95 @@ next_char (format_data *fmt, int literal
- while (c == ' ' && !literal);
+ while ((c == ' ' || c == '\t') && !literal);
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu dot
| |org
Status|RESOLVED |UNCONFIRMED
Keywords| |diagnostic
Resolution|FIXED |
Summary|GFortran FORMAT statement |TAB in FORMAT: accept
|error |extension, warn with -std=f*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32987
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/32987] TAB in FORMAT: accept extension, warn with -std=f*
2007-08-04 13:55 [Bug fortran/32987] New: GFortran FORMAT statement error satyaakam at yahoo dot co dot in
` (3 preceding siblings ...)
2007-08-04 16:53 ` [Bug fortran/32987] TAB in FORMAT: accept extension, warn with -std=f* burnus at gcc dot gnu dot org
@ 2007-08-04 17:00 ` sgk at troutmask dot apl dot washington dot edu
2007-08-04 17:38 ` burnus at gcc dot gnu dot org
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: sgk at troutmask dot apl dot washington dot edu @ 2007-08-04 17:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from sgk at troutmask dot apl dot washington dot edu 2007-08-04 17:00 -------
Subject: Re: TAB in FORMAT: accept extension, warn with -std=f*
On Sat, Aug 04, 2007 at 04:53:33PM -0000, burnus at gcc dot gnu dot org wrote:
>
>
> I therefore suggest:
> - Silently accept the tab in libgfortran
I disagree on this point. gfortran has been around for a long
time now and this is the first report of the tab-in-format
runtime error. gfortran should complain loudly that the
code is invalid.
> - Give a warning or an error with -std=f95/f2003.
What about -std=f66, f77, or f90? Yes, I know gfortran doesn't
have these levels, but the tab violates all fortran standards.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32987
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/32987] TAB in FORMAT: accept extension, warn with -std=f*
2007-08-04 13:55 [Bug fortran/32987] New: GFortran FORMAT statement error satyaakam at yahoo dot co dot in
` (4 preceding siblings ...)
2007-08-04 17:00 ` sgk at troutmask dot apl dot washington dot edu
@ 2007-08-04 17:38 ` burnus at gcc dot gnu dot org
2007-08-04 17:40 ` patchapp at dberlin dot org
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-04 17:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from burnus at gcc dot gnu dot org 2007-08-04 17:37 -------
> > - Silently accept the tab in libgfortran
> I disagree on this point.
Discussion -> fortran@gcc list; starts here:
http://gcc.gnu.org/ml/fortran/2007-08/msg00097.html
> > - Give a warning or an error with -std=f95/f2003.
> What about -std=f66, f77, or f90?
I meant: Give a warning for all -std=* except of -std=gnu/legacy; as gfortran
has no fIV, f66, f77, f90, f2008, F (yet?) the two statements are the same.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32987
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/32987] TAB in FORMAT: accept extension, warn with -std=f*
2007-08-04 13:55 [Bug fortran/32987] New: GFortran FORMAT statement error satyaakam at yahoo dot co dot in
` (5 preceding siblings ...)
2007-08-04 17:38 ` burnus at gcc dot gnu dot org
@ 2007-08-04 17:40 ` patchapp at dberlin dot org
2007-08-09 22:03 ` burnus at gcc dot gnu dot org
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: patchapp at dberlin dot org @ 2007-08-04 17:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from patchapp at dberlin dot org 2007-08-04 17:40 -------
Subject: Bug number PR32987
A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-08/msg00246.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32987
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/32987] TAB in FORMAT: accept extension, warn with -std=f*
2007-08-04 13:55 [Bug fortran/32987] New: GFortran FORMAT statement error satyaakam at yahoo dot co dot in
` (6 preceding siblings ...)
2007-08-04 17:40 ` patchapp at dberlin dot org
@ 2007-08-09 22:03 ` burnus at gcc dot gnu dot org
2007-08-09 22:08 ` burnus at gcc dot gnu dot org
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-09 22:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from burnus at gcc dot gnu dot org 2007-08-09 22:03 -------
Subject: Bug 32987
Author: burnus
Date: Thu Aug 9 22:02:32 2007
New Revision: 127324
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127324
Log:
2007-08-09 Tobias Burnus <burnus@net-b.de>
PR fortran/32987
* io.c (format_token): Add FMT_ERROR.
(next_char_not_space): Print error/warning when
'\t' are used in format specifications.
(format_lex): Propagate error.
(check_format): Ditto.
2007-08-09 Tobias Burnus <burnus@net-b.de>
PR fortran/32987
* io/format.c (next_char): Treat '\t' as ' ' in format specification.
2007-08-09 Tobias Burnus <burnus@net-b.de>
PR fortran/32987
* gfortran.dg/fmt_tab_1.f90: New.
* gfortran.dg/fmt_tab_2.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/fmt_tab_1.f90
trunk/gcc/testsuite/gfortran.dg/fmt_tab_2.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=32987
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/32987] TAB in FORMAT: accept extension, warn with -std=f*
2007-08-04 13:55 [Bug fortran/32987] New: GFortran FORMAT statement error satyaakam at yahoo dot co dot in
` (7 preceding siblings ...)
2007-08-09 22:03 ` burnus at gcc dot gnu dot org
@ 2007-08-09 22:08 ` burnus at gcc dot gnu dot org
2007-08-10 3:27 ` satyaakam at yahoo dot co dot in
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-09 22:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from burnus at gcc dot gnu dot org 2007-08-09 22:08 -------
FIXED for gfortran 4.3.0; gfortran now accepts the tab; it checks also at
compile time for the tab character and gives either a warning (-std=gnu/legacy)
or an error (-std=f95/f2003) if a tab has been found.
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32987
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/32987] TAB in FORMAT: accept extension, warn with -std=f*
2007-08-04 13:55 [Bug fortran/32987] New: GFortran FORMAT statement error satyaakam at yahoo dot co dot in
` (8 preceding siblings ...)
2007-08-09 22:08 ` burnus at gcc dot gnu dot org
@ 2007-08-10 3:27 ` satyaakam at yahoo dot co dot in
2007-08-10 3:50 ` sgk at troutmask dot apl dot washington dot edu
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: satyaakam at yahoo dot co dot in @ 2007-08-10 3:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from satyaakam at yahoo dot co dot in 2007-08-10 03:27 -------
Hi ,
Any plans to backport.
regards
Satya
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32987
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/32987] TAB in FORMAT: accept extension, warn with -std=f*
2007-08-04 13:55 [Bug fortran/32987] New: GFortran FORMAT statement error satyaakam at yahoo dot co dot in
` (9 preceding siblings ...)
2007-08-10 3:27 ` satyaakam at yahoo dot co dot in
@ 2007-08-10 3:50 ` sgk at troutmask dot apl dot washington dot edu
2007-08-14 13:46 ` fxcoudert at gcc dot gnu dot org
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: sgk at troutmask dot apl dot washington dot edu @ 2007-08-10 3:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from sgk at troutmask dot apl dot washington dot edu 2007-08-10 03:50 -------
Subject: Re: TAB in FORMAT: accept extension, warn with -std=f*
On Fri, Aug 10, 2007 at 03:27:33AM -0000, satyaakam at yahoo dot co dot in
wrote:
>
> Any plans to backport.
>
No.
Please fix your BROKEN code so gfortran doesn't need to
grow any further questionable extension.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32987
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/32987] TAB in FORMAT: accept extension, warn with -std=f*
2007-08-04 13:55 [Bug fortran/32987] New: GFortran FORMAT statement error satyaakam at yahoo dot co dot in
` (10 preceding siblings ...)
2007-08-10 3:50 ` sgk at troutmask dot apl dot washington dot edu
@ 2007-08-14 13:46 ` fxcoudert at gcc dot gnu dot org
2007-08-30 21:53 ` fago at caltech dot edu
2007-08-30 22:24 ` sgk at troutmask dot apl dot washington dot edu
13 siblings, 0 replies; 15+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-08-14 13:46 UTC (permalink / raw)
To: gcc-bugs
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32987
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/32987] TAB in FORMAT: accept extension, warn with -std=f*
2007-08-04 13:55 [Bug fortran/32987] New: GFortran FORMAT statement error satyaakam at yahoo dot co dot in
` (11 preceding siblings ...)
2007-08-14 13:46 ` fxcoudert at gcc dot gnu dot org
@ 2007-08-30 21:53 ` fago at caltech dot edu
2007-08-30 22:24 ` sgk at troutmask dot apl dot washington dot edu
13 siblings, 0 replies; 15+ messages in thread
From: fago at caltech dot edu @ 2007-08-30 21:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from fago at caltech dot edu 2007-08-30 21:52 -------
A stupid question: why cannot gfortran detect this invalid code at compile
time? I was quite surprised by a runtime error.
BTW, I was compiling some legacy code with 4.2.1 and just hit this ...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32987
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/32987] TAB in FORMAT: accept extension, warn with -std=f*
2007-08-04 13:55 [Bug fortran/32987] New: GFortran FORMAT statement error satyaakam at yahoo dot co dot in
` (12 preceding siblings ...)
2007-08-30 21:53 ` fago at caltech dot edu
@ 2007-08-30 22:24 ` sgk at troutmask dot apl dot washington dot edu
13 siblings, 0 replies; 15+ messages in thread
From: sgk at troutmask dot apl dot washington dot edu @ 2007-08-30 22:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from sgk at troutmask dot apl dot washington dot edu 2007-08-30 22:24 -------
Subject: Re: TAB in FORMAT: accept extension, warn with -std=f*
On Thu, Aug 30, 2007 at 09:52:56PM -0000, fago at caltech dot edu wrote:
>
> ------- Comment #12 from fago at caltech dot edu 2007-08-30 21:52 -------
> A stupid question: why cannot gfortran detect this invalid code at compile
> time? I was quite surprised by a runtime error.
>
See comment #9 in bugzilla.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32987
^ permalink raw reply [flat|nested] 15+ messages in thread