HP3000-L Archives

December 2003, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Stan Sieler <[log in to unmask]>
Reply To:
Stan Sieler <[log in to unmask]>
Date:
Wed, 10 Dec 2003 17:31:32 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (77 lines)
Re:
> **** Bound violation or range error (TRAPS 12).

> $SET 'X9=TRUE'$
> $IF 'NOT X9'$

Pascal allows *meaningful* flag names.  I'd replace X9 with
what it really means.  (e.g., $set 'testing = true'$ or some such)


>       bbuf  : string [maxmsg+8];
...
>       bbuf     := ' &j000L';

At this point, bbuf (a string) has 7 characters in it.

>       bbuf [1] := chr(27);

BTW, You can combine the above two:

        bbuf := #27'&j000L';


>       ilen := ASCII ( len, -10, bbuf [6]);

The above works "correctly" only if len is in the range -99 to +999,
because a value outside that range would "overflow" onto the "j" and then
the "&" ... note, of course, that this isn't a problem in your case
since maxmsg is < 1000.  I'd either document that or add a check to
ensure that len is in the range 0..999 (since negative len values can
cause other problems, I'm hoping you'll check for that earlier).


>       strmove ( len, msg, 1, bbuf, 8 );

The above is my candidate for what's causing the error ... if len is
an unexpected value.

To tell for sure, I'd want a compiler listing with $code_offsets on$,
which allows easy correlation of the abort location to source code.

Example of code_offsets on....

    2     8.000   1   dest := '1234567';
    3     9.000   1   source := 'cat';
    4    10.000   1   strmove (3, source, 1, dest, 8);
    5    11.000   1
    5    12.000   1   writeln ('dest = ', dest);
    6    13.000   1
    6    14.000   1   end.

                           C O D E   O F F S E T S


                                   PROGRAM

        STMT  OFFSET      STMT  OFFSET      STMT  OFFSET      STMT  OFFSET
           2      7C         4      B8         5     118         6     1B0
           3      A0

If my process aborted at PROGRAM+c0, I'd know that's within stmt 4
(which starts at byte offset $b8 and runs through $117).  Stmt 4 is at
line number 10 (according to the "4   10.000" line and "5 11.000" lines)


I'd also suggest checking the value of len (to make sure it's in the
range 0..maxmsg).

Stan
--
Stan Sieler
[log in to unmask]
www.allegro.com/sieler/wanted/index.html

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2