Comments (7)
No tools, just a lot of manual labor :) It took a couple of hours. I started by making a test program that only called cparams() by manually constructing the AST nodes. Once that program could replicate the bug, I deleted all the other mujs functions that were not used. After simplifying those that remained as much as I could while still triggering the bug, and "inlining" chains of function calls I ended up with the final test case.
from mujs.
This is making me very confused. My initial guess is that something somewhere is tripping up and letting GCC run wild with undefined behavior optimizations. Over-eager optimizing compiler writers are the usual villains in this kind of story...
from mujs.
Yes, I agree. A less nice work around for this issue is to ask gcc not to optimise the checkfutureword() function, i.e., add attribute((optimize("O0"))) to the function. I've created a pull request #153 for this workaround.
from mujs.
ask gcc not to optimise the checkfutureword()
That's not a good idea, because you don't actually know what causes it to mess this specific function. There could be other functions with the same issue which we don't know about, and this will not fix them.
The solution should be either to disable optimizations completely, or understand exactly why this function is messed up, and then find a solution which fixes it for all functions which have the same issue.
from mujs.
This turns out to be a bug in GCC's optimizer. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103052 for more details.
from mujs.
This turns out to be a bug in GCC's optimizer. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103052 for more details.
This is so cool that you analysed it out! I tried but failed to reduce the mujs code to a simpler test case. It's really nice to see that you made it. May ask you how you did that? Is there any tool you used?
from mujs.
There's a workaround that we need to keep in place until newer versions of GCC with the bug fix are common enough.
from mujs.
Related Issues (20)
- BUG HOT 2
- Does not build on macOS
- Warnings
- Get rid of setjmp HOT 1
- Object.keys([2,3]) returns [] instead of ["0", "1"] HOT 2
- String.prototype.replace() with global regex doesn't resolve correctly $`
- A performance issue caused by loop. HOT 2
- Suggestion - macro to make multi-threaded calls single-threaded
- The shared library should be built with SONAME
- Incorrect linker flag to build shared-lib on darwin
- Calling the join function on a self-referential array leads to a stack overflow.
- Unable to assign the eval function to a variable. Error: invalid use of 'eval'
- SyntaxError caused by the trailing comma in the function parameters. HOT 4
- Is it possible to increase the default stack size? HOT 19
- mujs github slug available
- The length of multi-code point Unicode characters is incorrect. HOT 9
- Unversioned shared library HOT 1
- MuJS compiling JS into a file opcode HOT 1
- Object.keys and Object.getOwnPropertyNames on Array returns indices twice HOT 2
- Declaring classes after functions causes a syntax error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mujs.