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
**tl=10,n=4 (correct)
dmc -o+all bug.c
bug
**tl=4,n=4 (error) Thanks. Eduardo Nunes edfpn 'at' hotmail 'dot' com begin 666 bug.c M"B\J+2TM*"!I9B!C;VUM96YT('1H92!D;W5B;&4 ;B!M96UB97( <')O8FQE M96-T("IG8SL-" ED;W5B;&4 ;CL)"2\J(&1O=6)L92!O<B!A;GD -C0 8FET M<R!T>7!E("AE>#H M:6YI="!B87-E(&9O<B!T:&4 97AA;7!L92 I+2TM+2TM+2TM+2TM+2TM+2TM M+2TM+2TM+2TM*B\-"E-T:TED(&EN:713=&LH=F]I9"D-"GL-" ES=&%T:6, M:7, ,3 *B\-" EI;G0 ;CL-" E3=&M)9"!B87-E/2A3=&M)9"EM86QL;V,H M<VEZ96]F*%1/8FIE8W0I*C I.PT*"69O<BAN/3 [(&X\.#L ;BLK*0T*"7L- M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TJ+PT*=F]I9"!F;V\H4W1K260 M8F%S92P :6YT('1O=&%L+"!I;G0 ;&%S="D-"GL-" E3=&M)9"!T;W /2!B M=&]T86P *0T*"7L-" D)=&P *ST *"8H=&]P+6XM,2DM/G9A;'5E+F=C+3YT M9B B=&P])60L;CTE9" H)7,I7&XB+'1L+&XL*'1L/3TQ,"D_(F-O<G)E8W0B M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM*B\-"FEN="!M86EN 2.PT*"7)E='5R;B P.PT*?0T* ` end
Sep 08 2003
parent "Walter" <walter digitalmars.com> writes:
Thanks, I can take it from here. -Walter
Sep 08 2003