On Fri, 24 Jun 2005, ov wrote:

> * What are the values of x, y, and mod when the assertion is hit?
> 32, -1, 64

This is quite strange because these values are nominal -- they shouldn't 
have triggered the assertion.

The assertion statement says:

  ASSERT (0 <= x && x < mod && -mod <= y && y <= mod);

substitution gives:

  0 <= 32 && 32 < 64 && -64 <= -1 && -1 <= 64

which is a true statement when x, y, and mod are integers, as they are
declared to be.

For example, when I do the same test on x86 
with modulo_add instrumentation added, I see the same 32/-1/64 parameter 
set.

Fri Jun 24 23:58:21 2005 TESTING ENCRYPT/DECRYPT of packet length=97
Fri Jun 24 23:58:21 2005 modulo_add(int x=92, int y=1, int mod=100)
Fri Jun 24 23:58:21 2005 modulo_add(int x=32, int y=-1, int mod=64)
Fri Jun 24 23:58:21 2005 modulo_add(int x=93, int y=1, int mod=100)
Fri Jun 24 23:58:21 2005 modulo_add(int x=31, int y=0, int mod=64)
Fri Jun 24 23:58:21 2005 modulo_add(int x=94, int y=1, int mod=100)

Combine this with your observation that making the function inline or 
turning off -O2 optimization fixes the problem, and it's starting to smell 
like a compiler bug.

James

Reply via email to