Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site hcrvx1.UUCP Path: utzoo!hcrvax!hcrvx1!tom From: tom@hcrvx1.UUCP (Tom Kelly) Newsgroups: net.lang Subject: Re: Runtime trapping of program bugs Message-ID: <1072@hcrvx1.UUCP> Date: Wed, 9-Jan-85 15:06:51 EST Article-I.D.: hcrvx1.1072 Posted: Wed Jan 9 15:06:51 1985 Date-Received: Thu, 10-Jan-85 03:24:57 EST References: <5143@rochester.UUCP> <19@decvax.UUCP> Organization: Human Computing Resources, Toronto Lines: 32 Some compilers on the Burroughs B7xxx/B6xxx also use hardware features to detect various run-time errors. I worked on a Pascal compiler that started all scalar values off with a special value (a TAG 6 for you Burroughs hackers) that could not be referenced for a value, only stored into. This caught references to uninitialized variables. It didn't do it for arrays, just scalars. Another Pascal compiler (from U. of Tasmania) put a TAG 6 into the index variable of a for loop, because its value is undefined at loop termination. The Fortran 77 compiler uses call by value/result for parameter passing. A constant parameter is passed by value. An attempt to modify it won't be detected (I think), but will not affect the caller. If my memory serves me correctly, we thought about trying to detect this, and decided it was not worth the trouble, although it would be possible. Also, the Fortran 77 compiler uses a hardware recognised "thunk" (a PCW), to detect misuse of parameters in subroutines with multiple ENTRYs. If you reference a parameter that is invalid because it is not defined as part of the ENTRY through which you enter the subroutine, the program is aborted with an appropriate error message. The TAG 6 word is also used in the implementaton of the ASSIGNED GOTO statement. The hardware detects an attempt to do arithmetic on a variable that as had a label value ASSIGNED to it (as in ASSIGN 10 TO I). Similarly, an attempt to do an ASSIGNED GOTO to a variable that contains an integer instead of a label is also detected. Tom Kelly (416) 922-1937 {utzoo, ihnp4, decvax}!hcr!hcrvx1!tom