[m-rev.] problems with abs for int{8,16,32}

Julien Fischer jfischer at opturion.com
Thu Feb 15 14:53:16 AEDT 2018


On Thu, 15 Feb 2018, Zoltan Somogyi wrote:

> The test cases arith_int{8,16,32} all fail in asm_fast.gc.debug.stseg
> with an error like this:
>
> --- arith_int16.exp	2018-01-15 18:23:15.388984921 +1100
> +++ arith_int16.out	2018-02-15 08:53:39.853500020 +1100
> @@ -28,7 +28,7 @@
>
> *** Test unary operation 'abs' ***
>
> -abs -32768 = <<exception>>
> +abs -32768 = -32768
> abs -128 = 128
> abs 0 = 0
> abs 1 = 1
>
> The arith_int64 test case succeeds, and all the tests are fine
> in asm_fast.gc as well.

They are *not* fine in asm_fast.gc, you weren't trying hard enough ;-)
(Try compiling with -O0.)

> I checked, and the abs operation on e.g. min_int8 throws
> an exception, as expected, when invoked directly from main,
> but the exception vanishes when invoked from within a try block.
>
> Julien, I think fixing this is up to you. I am attaching my cut-down
> test case to save you a bit of work.

The issue here is the handling of sub-word sized types in scalar common
data; the runtime machinery for doing looks up in common data cannot
handle fields being less than a word in size.  The fix here is to ensure
that an field in static data are at least a word in size (which is
indeed precisely how the MLDS backend handles it).

I'll post a fix for this in the next couple of days.

Julien.


More information about the reviews mailing list