-
Notifications
You must be signed in to change notification settings - Fork 174
Conditional jump or move depends on uninitialised value(s) #323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Now we have the source:
|
Do you remember at what commit that is? |
Current tip of tree, you can check here: https://github.com/quickjs-ng/quickjs/actions/runs/8364487250 |
Looks like the PC not always set on the JS stack frame structure that we allocate on the stack. I was tempted to send a patch zeroing out the structure but feels kinda wrong? |
Do you mean |
Yeah that's the one. I haven't tested it yet, hope to do that tonight! 🥃 |
zeroeing the stack frame may hide the problem and will add overhead to every function call. |
I have found the smallest repro case!
|
This is the smallest change I could come up with, which fixes it: #328 I couldn't quite follow what path lead to it not being set :-( However, since we initialize the stack frame there, I guess it makes sense to set |
The scenario is this:
It is quite surprising that this problem has not surfaced before. Also note that the stack dump construction is supposed to be delayed until it is needed for display or debugging and this bug shows that it is not the case since The stack trace cannot be built only when accessed because the stack frames would have been discard by that time, yet the call stack could be stored incrementally in the alternate return path along the call chain (in the This would produce a more precise stack trace with the actual On the other hand, to prepare for a much needed debugger that would need an exact stack trace at time the error constructor is called, this incremental approach is inappropriate. Conclusion:
|
Thanks for the explainer! I shall try to judiciously place those. |
Not sure I fully get this. When set it means it's not an active stack frame?
In
But when I check
Not sure I understand what you mean here 😅 I do see I'm updating the PR with the cases I found thanks for Valgrind, and I'm also making it possible to run Valgrind against a specific branch so we can know some more. I am a bit out of my depth here, so I appreciate the guidance @chqrlie ! |
An active stack frame is one that is in a call chain.
Yes, this delays the construction for most errors triggered from the bytecode to after the
Yes it would be too late if the backtrace has already been generated. We could build the backtrace incrementally as recursive calls get unwound, or at least the source locations could be stored incrementally. |
Caught using valgrind:
By the look of it, the value of
pc_value
passed tofind_line_num
is the one not initialized.The text was updated successfully, but these errors were encountered: