This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix fortran/13257, Error instead of warning for missingcomma in format string
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- Cc: gcc-patches Patches <gcc-patches at gcc dot gnu dot org>,"'fortran at gcc dot gnu dot org' list" <fortran at gcc dot gnu dot org>
- Date: Fri, 08 Apr 2005 20:20:37 +0200
- Subject: Re: [PATCH] Fix fortran/13257, Error instead of warning for missingcomma in format string
- References: <da8246144335454f3cdecad1725e9711@physics.uc.edu>
Andrew Pinski wrote:
> I decided to get my hands dirty with fixing some gfortran bugs so I
> started with a very
> simple bug. This is an extension which we used to accept with g77 and
> shows up in
> SPEC too which is one of the reasons why I decided to look into it.
Thank you.
> fortran/ChangeLog:
> * io.c (check_format): Allow an optional comma
> between descriptions.
They're called 'descriptors' :-)
> @@ -853,8 +854,8 @@ parse_format_list (void)
> goto finished;
>
> default:
> - error = "Missing comma in format";
> - goto finished;
> + /* Assume a missing comma, this is a GNU extension */
> + goto format_item_1;
> }
Please add a call to gfc_notify_std here, and depending on its result give an
error or continue parsing the format string. This is in line with our policy
regarding extensions and should alleviate Richard's concern, even though I
couldn't create a testcase exposing the ambiguity he referred to. Given the
subtleties of fixed-form I wouldn't be surprised if it really exists, and we
should definitely add it to the testsuite if someone can give an example.)
You should also test that the correct output is created.
(Just write to an internal unit, i.e. something like
CHARACTER(20) c
write (c,fmt) i, j, k
if (c /= ' whatever is expected ') call abort
end
this gives better testing and at the same time prevents us getting much longer
testsuite runtimes from writing to the disk during testing)
With these two fixes this is ok for both the mainline and the branch.
Thanks,
- Tobi