Skip to content
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

failed assert in script file crashes repl #1273

Closed
dubiousjim opened this issue May 28, 2024 · 1 comment · Fixed by #1278
Closed

failed assert in script file crashes repl #1273

dubiousjim opened this issue May 28, 2024 · 1 comment · Fixed by #1278
Assignees
Labels
bug Something isn't working

Comments

@dubiousjim
Copy link

I've confirmed this issue against c8fe77c, though I think it's been around for longer.

I have to make some small changes to the source to be able to build on my system, but I don't think these are responsible. The changes are:

diff --git c/CMakeLists.txt w/CMakeLists.txt
index 5b7e551..281f4dc 100644
--- c/CMakeLists.txt
+++ w/CMakeLists.txt
@@ -6,6 +6,9 @@ endif()
 
 cmake_minimum_required(VERSION 3.0)
 
+set(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH})
+set(CMAKE_INCLUDE_PATH /opt/local/include ${CMAKE_INCLUDE_PATH})
+
 option(LUAU_BUILD_CLI "Build CLI" ON)
 option(LUAU_BUILD_TESTS "Build tests" ON)
 option(LUAU_BUILD_WEB "Build Web module" OFF)
diff --git c/CLI/FileUtils.cpp w/CLI/FileUtils.cpp
index 2e17bcb..c3b1eac 100644
--- c/CLI/FileUtils.cpp
+++ w/CLI/FileUtils.cpp
@@ -20,6 +20,7 @@
 #endif
 
 #include <string.h>
+#include <sys/errno.h>
 
 #ifdef _WIN32
 static std::wstring fromUtf8(const std::string& path)

My system is a Mac OS 10.15.7 with MacPorts.

The issue only arises with a debug build of Luau. Here is my build command:

cd cmake
cmake .. -DCMAKE_BUILD_TYPE=Debug;
cmake --build . --target Luau.{Repl,Analyze,Compile}.CLI --config Debug;

To produce the problem, create a script file testx.lua containing the text assert(false). (I cannot generate the problem by typing this into the interpreter/repl, it has to be in a script file.)

Then invoke the debug build of the interpreter like this:

$ ./luau -i testx.lua

One gets an error message and prompt in the interpreter, as expected. Press any key. Now the interpreter crashes. Here's a sample session:

$ ./luau -i ../testx.lua
../testx.lua:1: assertion failed!
stacktrace:
[C] function assert
../testx.lua:1
>  /Users/jim/repo/luau/VM/src/lapi.cpp(281): ASSERTION FAILED: L->top < L->ci->top
Illegal instruction: 4
@dubiousjim dubiousjim added the bug Something isn't working label May 28, 2024
@dubiousjim dubiousjim changed the title failed asser in script file crashes repl failed assert in script file crashes repl May 28, 2024
@vegorov-rbx vegorov-rbx self-assigned this May 28, 2024
@vegorov-rbx
Copy link
Collaborator

Thank you for the report, we'll fix this issue soon.

alexmccord added a commit that referenced this issue May 31, 2024
### What's new?

* Remove a case of unsound `table.move` optimization
* Add Luau stack slot reservations that were missing in REPL (fixes
#1273)

### New Type Solver

* Assignments have been completely reworked to fix a case of cyclic
constraint dependency
* When indexing, if the fresh type's upper bound already contains a
compatible indexer, do not add another upper bound
* Distribute type arguments over all type families sans `eq`, `keyof`,
`rawkeyof`, and other internal type families
* Fix a case where `buffers` component weren't read in two places (fixes
#1267)
* Fix a case where things that constitutes a strong ref were slightly
incorrect
* Fix a case where constraint dependencies weren't setup wrt `for ...
in` statement

### Native Codegen

* Fix an optimization that splits TValue store only when its value and
its tag are compatible
* Implement a system to plug additional type information for custom host
userdata types

---

### Internal Contributors

Co-authored-by: Aaron Weiss <aaronweiss@roblox.com>
Co-authored-by: Alexander McCord <amccord@roblox.com>
Co-authored-by: Andy Friesen <afriesen@roblox.com>
Co-authored-by: Vighnesh Vijay <vvijay@roblox.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>

---------

Co-authored-by: Aaron Weiss <aaronweiss@roblox.com>
Co-authored-by: Andy Friesen <afriesen@roblox.com>
Co-authored-by: Vighnesh <vvijay@roblox.com>
Co-authored-by: Aviral Goel <agoel@roblox.com>
Co-authored-by: David Cope <dcope@roblox.com>
Co-authored-by: Lily Brown <lbrown@roblox.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants