[kaffe] Re: Computing remainders

Tony Wyatt wyattaw at optushome.com.au
Sun Jun 29 05:00:01 PDT 2003


Hi Dalibor,

On 29/06/03, you wrote:

> Here's what I believe is the problem with the current test:
> return foo(LONG_MIN, -1l) == 0
> 
> The boolean expression is true when LONG_MIN % -1l == 0, i.e. when
> LONG_MIN % -1L works like in the Java spec. It is false ( i.e. zero in C)
> otherwise.
> 
> Returning 0 from the main function in C means that the program completed
> its task successfully [1]. the configure script interprets that as 'hey,
> it worked! long modulo is not broken, then', when in fact it is.
> 
I generated that patch very carefully so that the test would:
(1) set LONG_MODULO_BROKEN (LMB) if the test program fell over;
(2) set LMB if the program ran and returned a zero (false) result: and
(3) clear LMB if (and only if) the test program ran without failure and
returned a non-zero (true) result.

I tested it with good and bad tests in the division, and with deliberate
faults that made the program fall over.

Either I blew it at the time and it works by accident, or you are reading it
wrongly. I rather suspect it's my fault and it works here by accident.
Unfortunately, it's 2200 on Sunday night and I've enjoyed a big dinner with
several glasses of wine, so I'm not capable of rational thought (or speech).

Please take another look and recheck my logic. I understand your preference
to return SUCCESS or FAILURE, but I reversed it to cope with the
failure-to-run case on <anything that generates an exception>.

> So I'd prefer to explicitely return EXIT_SUCCESS and EXIT_FAILURE to make
> the code even more explicit. I think the line above should be rewritten
> as:
> 
> /* snip */
> 
> Could you give it a try on the Amiga ?
> 
Not tonight, but I will ASAP. Besides my brain (what's left of it) is
swimming with slots and register allocations [still can't figure out what's
wrong with JIT3 on this machine].

cheers

tony





More information about the kaffe mailing list