www.digitalmars.com         C & C++   DMDScript  

c++ - [Re] using Lua

reply "Eduardo Nunes" <edfpn hotmail.com> writes:
Hi,

Some time ago, I reported a bug while compiling Lua script language
(5.0), but I couldn't isolate the problem on a smaller example.

Now, I have manage to separate it from Lua source.

The problem happens when compiling with optimizations (-o+all)

The while loop in foo function, loops exactly the same as the non
optimize version, but in the optimized version the tl value isn't
updated at loop exit, (I can't find tl value inside the loop, because
any use of tl, (such as printf) makes the problem to disappear).

Note that the while condition doesn't have side effects and it's body
only accumulates the lengths in tl and increment n.

There is also the case that if I remove the double n member of the
Value union the problem disappear.
This pattern repeats for the 64 bits types (double, long long int).

The compiler version is 8.35n

dmc bug.c
bug

dmc -o+all bug.c
bug

Thanks. Eduardo Nunes edfpn 'at' hotmail 'dot' com
Sep 08 2003
parent "Walter" <walter digitalmars.com> writes:
Thanks, I can take it from here. -Walter
Sep 08 2003