This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, fortran] PR38398 g0.w edit descriptor: Update for F2008 Tokyo meeting changes
- From: Tobias Burnus <burnus at net-b dot de>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Sun, 14 Dec 2008 13:52:15 +0100
- Subject: Re: [patch, fortran] PR38398 g0.w edit descriptor: Update for F2008 Tokyo meeting changes
Jerry,
thanks for your patch. However, if I read
http://www.j3-fortran.org/doc/year/08/08-296r2.txt
correctly, also for "g0" and not only for "g0.d one needs
to remove the trailing/heading spaces:
"When used to specify the output of real or complex data that is not an
IEEE infinity or NaN, the G0 and G0.<d> edit descriptors follow the rules
for the G<w>.<d>E<e> edit descriptor, except that any leading or trailing
blanks are removed."
Example:
print '(a,g0,a)','>', 334, '<'
print '(a,g0,a)','>', 334.04,'<'
print '(a,g0.3,a)','>', 334, '<'
print '(a,g0.3,a)','>', 334.04,'<'
end
gives currently:
>334< ! OK
> 334.04001 < ! g0 - trailing/heading spaces!
>334< ! OK
>334.040< ! g0.3 - OK
Regading the fmt checking: I think the new diagnostic is much
better, however, I think it is off by one:
print '(g0.3e0)', 334.04
1
Error: E specifier not allowed with g0 descriptor in format string at (1)
print '(a,i)', "a", 1
1
Error: Nonnegative width required in format string at (1)
The problem with the position is that one does not know for the last
example whether it points to the item before or after the comma.
Otherwise it looks OK. Can you also add a testcase which tests that the
output is correct? (no heading spaces etc.)
Tobias