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 -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


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, PUC-Rio
 > x = 2^3
 > =x
 > y = 10 % x
 > =y
 > z = 2^3
 > =z

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     <>      +1 416 348 1594
SOMA Networks, Inc.  +1 416 977 1414