TERRA Datentechnik, Technical Support Sheet
--------------------------------------------------------------------------
Toni Gorrengourt, TERRA Basel
29-May-92, Ref. TB-920529.4
04-Aug-92, Ref. TZ-920804.1/Bj -> fixed
Priority: 1

Related files:     Support Disk,  HINTS\STARTERM.TXT
                   BBS, SIG M2V4, STARTERM.TXT
               
Corrected RTS in : Support Disk, BUGS\RTS4-01.ZIP
                   Mailbox SIG M2V4 RTS4-01.ZIP

RTS / Library: "RTSTerm.Terminate"
               (also affected: "Storage", "DynMem", and some others)
4.0

Incomplete Exception Handling/Termination When Using "RTSTerm.Terminate"
------------------------------------------------------------------------

We have taken the effort to understand how program startup and
termination are implemented in M-2 V4, see attached file STARTERM.TXT.
As illustrated there, calling "RTSTerm.Terminate" will directly call
"RTSExec.TerminateExecution" and terminate the Modula-2 program
without activating the exception handling, and thus usually without
any message, even in case of a run-time error. Because modules like
"Storage", "DynMem", and some others call "RTSTerm.Terminate" in case
of a run-time error (e.g. heap overflow), the program will usually
terminate silently in such a case. The same is going to happen for
all converted 3.40 programs that used "RTSMain.Terminate" (and now
probabely use "RTSTerm.Terminate") to terminate the program in some
error situation with some error code.

Correction needed: "RTSTerm.Terminate" should terminate by calling
"Error.DoHalt" instead of "RTSExec.TerminateExecution", such that
full error info is displayed and full exception handling occurs.
Given that even normal termination (see code generated by compiler
for END of main module body) goes through "Error.DoHalt", this seems
to be the logical implementation for "RTSTerm.Terminate".

Work-Around: Directly call "Error.DoHalt (ORD (statusValue))" instead
of "RTSTerm.Terminate (statusValue)" in application modules.

Note: This bug has the side effect, that the method that MultiScope
Inc. recommended (see SHOWRTE.TXT, .ZIP) for being able to see the 
call chain in case of a run-time error (install exception handler 
that causes a BPT) does not work for errors like heap overflow and 
others that cause program termination by calling "RTSTerm.Terminate".

Note: A corrected RTS is available. Please refer to the header of
      this TSS.
                                * * *