Evading intent(in)

Yes, fpt will handle legacy FORTRAN 77 with all the VMS, MPX and most other extensions. It will change the code to free format and re-program many of the extensions.

The current version of fpt checks INTENT declarations and reports possible violations, but it does not add INTENT declarations. We have already been asked to do this and the code is close to completion. We have two flags - IN means that the variable can be read before it is assigned, OUT means that it is assigned in reachable code. fpt does a complete control flow analysis so checking IN is easy. We just have to find a path from the entry to a read. Checking OUT is also easy, we have to find a path from the entry to the write and a path from the write to the return. The difficulty is in proving INTENT(OUT) which requires that any read of any part of the object takes place after that part has been written.

A further complication is that fpt necessarily has more intents that IN, OUT and INOUT. The others are NONE (the argument is unused), ATTRIB (the attributes, array bounds, allocation status, presence etc. are used but not the data), function formal argument, subroutine formal argument and label reference (either executable or format). I wonder whether these would be useful in the language, but that is another issue.

Look out for an fpt which will add INTENT specifications in the next month.

Best wishes,

John

2 Likes

Makes me curious how the stdlib efforts would fair if run through fpt! Sounds like it handles a lot of the issues often posted on Fortran forums about migrating to more modern syntax, making code more portable, etc. Interesting.