[M3devel] Assertion failed to complain

Hendrik Boom hendrik at topoi.pooq.com
Thu Feb 9 18:52:20 CET 2012


On Thu, Feb 09, 2012 at 11:56:24AM -0500, Hendrik Boom wrote:
> 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.
> 

For the record, I'm running 

Critical Mass Modula-3 version 5.8.4
  last updated: 2009-11-02
  compiled: 2009-11-03 13:57:35
  configuration: /usr/local/cm3/bin/cm3.cfg
  host: LINUXLIBC6
  target: LINUXLIBC6

-- hendrik




More information about the M3devel mailing list