[M3devel] Assertion failed to complain

Daniel Alejandro Benavides D. dabenavidesd at yahoo.es
Thu Feb 9 18:51:24 CET 2012


Hi all:
It might be that needs to be uppercase (in case compiler doesn't warn but I guess that would desired behavior, or not, since it would be unknown at compile time).
<*ASSERT exp*>

Thanks in advance

--- El jue, 9/2/12, Hendrik Boom <hendrik at topoi.pooq.com> escribió:

> De: Hendrik Boom <hendrik at topoi.pooq.com>
> Asunto: [M3devel] Assertion failed to complain
> Para: m3devel at elegosoft.com
> Fecha: jueves, 9 de febrero, 2012 11:56
> 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