lanl/FLPR

parse_files chokes on legacy idiom: do-loop terminating label assigned to non-continue line

apthorpe opened this issue · 3 comments

I was torture-testing parse_files on some old EISPACK code and I ran across an idiom that causes indigestion:

       do 100 i = mp1, igh
100    z(i,mp) = a(i,mp-1)

It appears that having the do-terminating line label assigned to something other than continue causes an unrecognized statement error. Moving 100 to a continue statement solves this problem. I also tested adding more lines between do and the terminating 100 but that had no effect.

This is bad style in modern code but it's unfortunately common in legacy code; not surprising that it tripped up the parser (hence the torture testing...)

pjh40 commented

Yes, nonblock-do constructs like that are what killed me when trying to parse sioeis, as suggested by @schwehr. FLPR is currently cheating by recognizing a labeled CONTINUE as a nonblock-do end, but I need to implement the full spec. I'll start by revising the documentation to explain this...

pjh40 commented

Working on adding full support for nonblock-do constructs. This is a bit of a challenge because nonblock-do is a deleted feature in Fortran 2018, so we need to work with an earlier spec (2008), which, of course, is in conflict with the current do-construct specification. For example, the CONCURRENT loop-control rule in the old spec for a block-do-construct requires a forall-header, while the CONCURRENT loop-control rule in the current spec for [block-]do-construct requires a concurrent-header and a concurrent-locality.

pjh40 commented

Should work now. Please reopen if I missed something.