This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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, fortran] PR41075 Add unlimited format item [F2008]


On 08/17/2009 05:49 AM, Jerry DeLisle wrote:
> The attached patch adds the unlimited format feature '*' to gfortran.
> [...]
> The feature allows some handy input/output for example when an array
> size is not know until run time.  When used in conjunction with the g0
> edit descriptor, you can read/write just about anything all chunk-ed
> together.  I can see its usefulness for data serialization.

It is also useful to write comma-separated values.

> I have also attached a simple test case.  I should mention that right
> now I do not check for nested '*' in a format string.  I think it may
> be meaningless because you can never exhaust one to allow the other to
> take effect.  We probably want to think about that and I have not
> studied the F2008 standard in closer detail to see if there is indeed
> a constraint defined.
I could not find any constraint; printing an error is probably wrong,
but one could print a warning, if one wants to.

> Finally, of lesser import, I have modified several error checks to use
> the %L feature to give some better error loci.
Great! I think error loci were a weak point of gfortran.

> Disallowing exponent width with D format specifier may be
> controversial, though correct.
How about just rejecting it for -std=f* ? I just tried the D edit
descriptor with g95 -std=f90 -Wall, NAG f95, ifort, openf95 and sunf95:
None of them rejected it (or warned about it) -  not even the very picky
NAG f95 compiler.  Looking at my real-world code, I also found some
usage of "D".


In the following block you are adding trailing spaces:

   goto format_item;
-
+  
 syntax:


> Regression tested on x86-64.  OK for trunk:
OK after considering the points made above.

Thanks for the patch.

Tobias

PS: Could you update the wiki (GFortran -> new, Fortran2008status) after
committing the patch?

> 2009-08-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
>
>     PR fortran/41075
>     * scanner.c (gfc_next_char_literal): Add comment to improve
>     readability.
>     * io.c (enum format_token): Add FMT_STAR. (format_lex): Add case
>     for '*'. (check_format): Check for left paren after '*'.  Change
>     format checks to use %L to improve format string error locus.
>     Disallow exponent width with D format specifier.
>
> 2009-08-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
>
>     PR fortran/41075
>     * io/io.h (enum format_token): Add FMT_STAR.
>     * io/format.c (format_lex): Add case for FMT_STAR.
>     (parse_format_list): Parse FMT_STAR and check for left paren
>     after. (next_format0): Modify helper function to check for
>     unlimited format and return the repeated format node.  Update
>     comments to clarify.


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