This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/66708] Possible (minor) improvement on formatted io with format too short
- From: "gerhard dot steinmetz dot fortran at t-online dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 30 Jun 2015 16:45:18 +0000
- Subject: [Bug fortran/66708] Possible (minor) improvement on formatted io with format too short
- Auto-submitted: auto-generated
- References: <bug-66708-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66708
Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
--- Comment #1 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
Formatted read or write with no variable list needs a format (fmt)
string longer than one character.
This is checked already -- partly -- but very good, indeed.
Please take a look at the message text.
$ cat z_write_fmt_too_short_1.f90
program p
character(1), parameter :: fmt1 = '('
character(1) :: fmt2 = '('
write (*, fmt1)
write (*, fmt2)
write (*, '(')
end
$ gfortran -g -O0 -Wall -fcheck=all z_write_fmt_too_short_1.f90
z_write_fmt_too_short_1.f90:4:14:
write (*, fmt1)
1
Error: Unexpected end of format string in format string at (1)
z_write_fmt_too_short_1.f90:6:14: Error: Unexpected end of format string in
format string at (1)
---
$ cat z_write_fmt_too_short_0.f90
program p
character(1), parameter :: fmt1 = '('
character(1) :: fmt2 = '('
write (*, fmt1(1:0))
write (*, fmt2(1:0))
write (*, '')
end
$ gfortran z_write_fmt_too_short_0.f90
z_write_fmt_too_short_0.f90:4:13:
write (*, fmt1(1:0))
1
Error: Missing leading left parenthesis in format string at (1)
z_write_fmt_too_short_0.f90:6:13:
write (*, '')
1
Error: Missing leading left parenthesis in format string at (1)