jacobwilliams / math77

Unofficial Mirror of the JPL MATH77 Library
http://www.netlib.org/math/
Other
8 stars 1 forks source link

Rewinds yield wrong result during merge of strings #2

Closed drbitboy closed 4 years ago

drbitboy commented 4 years ago

Hi Jacob,

You don't know me, but I just found a bug in exsort.f, and I know the fix.

I will generate a minimal test case (it's an obscure bug, so that's the tricky part) to make your Pull Request process go more smoothly. Also, I am in the middle of something else, so that may take some time, but since no one found this in the past nearly quarter century, I feel safe assuming there is no rush.

I realize Github is not the final upstream, but it will be easier for me to do a PR on Github, and you can handle the upstream, if that is okay with you.

Also, I attached a version of the current exsort.f with fuller, and what I hope are better, comments for the initial portion of the code (the second portion, with the merge, will be much tougher to make cogent comments).

Best regards,

Brian Carcich exsort_commented.zip

drbitboy commented 4 years ago

I apologize, false alarm; I will close this issue.

I might look into improving the description of IOP=5, but that would be an edit to only the comments of exsort.f.

TL;DR

I had a DATASORT routine that was using I/O with ACCESS='DIRECT' (Navio files), so REWIND is a concept that does not apply for me per the usual I/O domain. The bad code in DATAOP updated its internal READ pointer but did (and could!) not update its internal WRITE pointer.

Fortuitous result, though: if the rewind is re-coded to do nothing (resets neither READ nor WRITE internal pointers for the Navio/ACCESS='DIRECT' case), the sort works!

Heh, three weeks to find it and then insert one C character (comment) to fix code harboring a hidden bug for a quarter-century.