Re: Weird numeric for loop counter variable behavior

  • From: "Yichun Zhang (agentzh)" <agentzh@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 6 Mar 2014 12:16:29 -0800

Hello!

On Wed, Mar 5, 2014 at 10:54 PM, Cheyi Lin wrote:
> Yes, It really happened a couple of times a week in my project, I got
> i = 5 and N = 4 !
>

I suggest you try out the latest master or v2.1 branch in the
luajit-2.0 git repos (see http://luajit.org/download.html ).

We used to see such weird things due to out-of-sync BASE and PC
registers as well. And we helped Mike Pall chase down and fix several
important bugs in the JIT compiler that could lead to this in the last
few weeks.

If you can still reproduce such issues with the latest v2.1 branch,
please apply the following patch to the v2.1 branch of LuaJIT:

    http://agentzh.org/misc/luajit/v2.1-ring-buffer-logging-v6.patch

And make your program generate a core dump when the weird code path is
taken. We can get detailed info from the core dump with the help of my
gdb tools below:

    https://github.com/agentzh/nginx-gdb-utils

We used this way to help Mike trace down the recently fixed bugs in
LuaJIT, most of which have been hidden for long (because that the JIT
compiler was usually under exercise).

Best regards,
-agentzh

Other related posts: