[M3devel] Assertion failed to complain
Hendrik Boom
hendrik at topoi.pooq.com
Thu Feb 9 17:56:24 CET 2012
Presumably there's something I have to do (or make sure I don't do) to
make assertion chacking work.
With the following two lines in my program:
<* assert segment.end + 1 >= segment.start *>
indices := NEW(REF ARRAY OF INTEGER, segment.end - segment.start +
1);
I get a runtime error
***
*** runtime error:
*** An enumeration or subrange value was out of range.
*** file "../src/runtime/common/RTAllocator.m3", line 340
***
Running this in m3gdb, I see that line 340 is indeed the assignment to
'indices' above, and that the assertion has sowehow failed to complain.
Printing out a few expressions in the debugger, I get
(m3gdb) up
#19 0x080498ba in sortsegment (segment=16_b6be01b8) at
../src/Main.m3:218
218 indices := NEW(REF ARRAY OF INTEGER, segment.end -
segment.start + 1);
(m3gdb) print segment.end
$1 = 0
(m3gdb) print segment.start
$2 = 3
(m3gdb) print segment.end + 1 >= segment.start
$3 = FALSE
(m3gdb) print segment.end - segment.start + 1
$4 = 4294967294
Yes, the 'end' and 'start' fields are declared INTEGER.
Somehow, this slipped past the ASSERT statement.
-- hendrik
More information about the M3devel
mailing list