This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix fortran/13257, Error instead of warning for missingcomma in format string


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]