lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


We've been having some odd problems with the exponent operator ('^') and modulus operator ('%') on our PowerPC deployment environment; this issue doesn't exist on our x86 development environment. We cross compile on x86 to the ppc target.

The tombstone data is:

Lua: 5.1.3

Make:
make -C src MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-Wl,-E -ldl -lncurses" all

Make Output:

powerpc-linux-gcc -O2 -Wall -DLUA_USE_POSIX -DLUA_USE_DLOPEN -c -o lapi.o lapi.c powerpc-linux-gcc -O2 -Wall -DLUA_USE_POSIX -DLUA_USE_DLOPEN -c -o lcode.o lcode.c powerpc-linux-gcc -O2 -Wall -DLUA_USE_POSIX -DLUA_USE_DLOPEN -c -o ldebug.o ldebug.c

<snip/>

Host: ppc 32-bit

Given the following script, it produces the correct results on both x86 and ppc:

 y = 2^3
 print('y = ', y)

 x = 10 % y
 print('x = ', x)

 y = 2^3
 print('y = ', y)

The output on both platforms is:

 y =     8
 x =     2
 y =     8

However, if we run the morally equivalent series of operations directly in the lua interpreter on the target ppc system, we get a different result:

 Lua 5.1.3  Copyright (C) 1994-2008 Lua.org, PUC-Rio
 > x = 2^3
 > =x
 8
 > y = 10 % x
 > =y
 2
 > z = 2^3
 > =z
 4.0096609170284

We've seen similar oddities in other lua apps we've written in the past. This just happens to be the smallest subset of statements that seems to reproduce the problem consistently.

--
Glenn McAllister     <glenn@somanetworks.com>      +1 416 348 1594
SOMA Networks, Inc.  http://www.somanetworks.com/  +1 416 977 1414