On 4/19/2020 3:57 AM, Barry Whenman wrote:
Thanks for your reply Paul,
I'm reluctant to share publicly as this is client code, but I can try to send you something privately.
My test case is based heavily on the original, and in particular it includes all the original index values (which range from 900-922 with a significant gap at 919); even though I've reduced the code to just a dummy display statement in most cases.
The error actually occurs within a library call - and I've replicated that in my test - just in case. The only other difference I'm aware of is that the real code runs as an MCS.
Ultimately this is just for my own understanding. I can fix the code by including an Else - though it would be better to understand where the 919 has suddenly started appearing from, in a program that has been in production for many years!
Thanks again
Barry.
Just to close this issue for everyone else who has been following it,
Barry sent me the source code in question. After some research on my
part and additional investigation on his, it appears that the production
and test systems he was using are both E-mode Eta (TARGET=LEVEL6)
systems, both are running MCP 18 (although at somewhat different patch
levels), and while the test code had been compiled for LEVEL6, the
production code had not been recompiled in a while and was for E-mode
Epsilon (TARGET=LEVEL5).
Compiling his code for both levels, I discovered that Algol CASE
statements generate quite different code between the two levels. LEVEL5
uses traditional in-line code to check the bounds of the case indexes immediately after the branch index is evaluated, followed by a branch to
the point after the CASE where a branch table is constructed for use by
the DBUN operator.
For LEVEL6, the branch to the point after the CASE occurs immediately
after the case index is evaluated. The code there begins with a BTAB
(hex 73) operator, followed by two 40-bit binary numbers containing the
upper and lower case index bounds, followed by a branch table consisting
of the necessary number of 32-bit BXTD branch instructions. BTAB looks
to be a LEVEL6 addition specifically designed for this type of bounded,
indexed branch. It must be doing the bounds checking and branch
selection all in firmware.
It appears that for, both E-mode levels, the use of an invalid case
index leads to execution of a ZERO, ASRT 252 sequence, which will
generate an invalid assertion interrupt. Why one system reports "INVALID
CASE" and the other "ASSERTION FAILURE" remains unclear.
Paul
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)