This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/66708] New: 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:43:57 +0000
- Subject: [Bug fortran/66708] New: Possible (minor) improvement on formatted io with format too short
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66708
Bug ID: 66708
Summary: Possible (minor) improvement on formatted io with
format too short
Product: gcc
Version: 5.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: gerhard.steinmetz.fortran@t-online.de
Target Milestone: ---
Formatted read or write of a variable (list) needs a format (fmt)
string longer than 2 characters, because of parentheses ( ) and
at least one character for an edit descriptor (e.g. a, g0, i8).
At least if the fmt string is constant/unchangeable, an error message
could be given at compile time. Otherwise a runtime error occurs.
Here with write, same for read and print.
$ cat z_write_fmt_too_short_2_item.f90
program p
character(2), parameter :: fmt1 = '()'
character(2) :: fmt2 = '()'
integer :: n = 1
3 format ()
write (*, fmt1) n
write (*, fmt2) n
write (*, '()') n
write (*, 3) n
end
$ gfortran -g -O0 -Wall -fcheck=all z_write_fmt_too_short_2_item.f90
$ a.out
At line 6 of file z_write_fmt_too_short_2_item.f90 (unit = 6, file = 'stdout')
Fortran runtime error: Insufficient data descriptors in format after reversion