Consolidating format checking - a 4.7 concept
Tobias Burnus
burnus@net-b.de
Sat Sep 25 14:18:00 GMT 2010
Jerry DeLisle wrote:
> I am thinking about consolidating format checking between FE and
> runtime. I would like to define a work function that can be called by
> the FE at compile time and likewise used at runtime.
While I like the idea, I do not see yet how this could be best done. At
least by default settings, the FE is compiled for $HOST and libgfortran
for $TARGET - thus one cannot easily call libgfortran functions to do
the checking. However, I am sure that's solvable.
> I am thinking that if the format string is a constant, then call the
> check routine and instead of saving the string into the dt structure,
> save an already parsed structure. Then at runtime, we only have to
> traverse the structure, and not parse it as we do now.
I think that's useful - especially as format strings tend to be
compile-time constants.
Thomas suggested something similar for the string-based arguments to the
I/O statements, cf. PR 45715. That task is a bit simpler as for a simple
string parsing the duplication between FE and libgfortran does not matter.
> Regardless, my main motivation is not performance. We can achieve
> better FE diagnostics and greatly simplify maintanance by having only
> one tokenizer etc, etc, etc. It is concievable that one could match
> up io data elements with specific format specifiers at compile time
> and inline the format specifier with the transfer_*** function calls.
> Spooky thoughts!
If we modify the I/O functions, maybe one can also somehow separate (at
least for the FE) the reads from the writes - currently the function
annotation ("fn spec") is "W" even for WRITE statements as the same
transfer function is used. Maybe something clever can be done in the
library without introducing more complexity or overhead of having
wrapper functions. Maybe it could also be done in FE by having
duplicated decls?
> A topic for the IRC meeting along with, er uh hmm, oh yea, User
> Defined Derived Type IO.
I think that goes together with breaking the ABI, thinking of the
AsyncIO ABI, the FMT/argument parsing and a general libgfortran cleanup.
Tobias
More information about the Fortran
mailing list