http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47434
Summary: Wrong field width for NaN with (F0.n) formatting Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libfortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: thenl...@users.sourceforge.net When formatting NaN with a F edit descriptor where the field width is zero, the string "<blank>NaN" is written (field width = 4). The expected string would be "NaN" (field width = 3, the smallest positive actual field width that does not result in a field filled with asterisks). For example: program testnan real :: n = 0.0 n = 0.0 / n print "(F0.2)", n print "(F3.2)", n end program testnan Output: <blank>NaN NaN 10.7.2.1 (6) On output, with I, B, O, Z, F, and G editing, the specified value of the field width w may be zero. In such cases, the processor selects the smallest positive actual field width that does not result in a field filled with asterisks. The specified value of w shall not be zero on input. 10.7.2.3.2 F editing For an internal value that is an IEEE NaN, the output field consists of blanks, if necessary, followed by the letters 'NaN' and optionally followed by one to w - 5 alphanumeric processor-dependent characters enclosed in parentheses, right justified within the field. If w is less than 3, the field is filled with asterisks.