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

[BUG]: mojo crash: Assertion `size() >= N && "Dropping more elements than exist"' failed. #2401

Open
junweizeng opened this issue Apr 25, 2024 · 1 comment
Labels
bug Something isn't working mojo Issues that are related to mojo mojo-repo Tag all issues with this label

Comments

@junweizeng
Copy link
Contributor

junweizeng commented Apr 25, 2024

Bug description

mojo crashes on the following code (i.e. test.mojo).

import object
def main():

Steps to reproduce

$ mojo build test.mojo
/path/to/test.mojo:1:8: error: unable to locate module 'object'
import object
       ^
mojo: /__w/modular/modular/third-party/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:205: ArrayRef<T> llvm::ArrayRef<mlir::Type>::drop_front(size_t) const [T = mlir::Type]: Assertion `size() >= N && "Dropping more elements than exist"' failed.
Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.
Stack dump:
0.      Program arguments: mojo build test.mojo
1.      Crash resolving decl signature at loc("/path/to/test.mojo":2:5)
    >> def main():
           ^......<
 #0 0x0000557eb9f73f57 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/jwzeng/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x1c32f57)
 #1 0x0000557eb9f71b2e llvm::sys::RunSignalHandlers() (/home/jwzeng/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x1c30b2e)
 #2 0x0000557eb9f745ef SignalHandler(int) (/home/jwzeng/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x1c335ef)
 #3 0x00007f5a8f62e520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007f5a8f682a7c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x00007f5a8f682a7c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x00007f5a8f682a7c pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x00007f5a8f62e476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x00007f5a8f6147f3 abort ./stdlib/abort.c:81:7
 #9 0x00007f5a8f61471b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007f5a8f625e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x0000557eba36134c M::KGEN::LIT::DeclResolver::exportMain(M::KGEN::LIT::ASTDecl&) (/home/jwzeng/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x202034c)
#12 0x0000557eba34b415 M::KGEN::LIT::DeclResolver::resolveSignature(M::KGEN::LIT::FuncOp, M::KGEN::LIT::Lexer&, M::KGEN::LIT::ASTDecl&) (/home/jwzeng/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x200a415)
#13 0x0000557eba35ebce M::KGEN::LIT::DeclResolver::resolve(M::KGEN::LIT::ASTDecl&, M::KGEN::LIT::DeclResolvedness, llvm::SMLoc) (/home/jwzeng/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x201dbce)
#14 0x0000557eba35f6a8 M::KGEN::LIT::DeclResolver::resolveAllReferencedFrom(M::KGEN::LIT::ASTDecl&) (/home/jwzeng/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x201e6a8)
#15 0x0000557eba36a2a2 importMojoImpl(M::LLCL::Runtime&, llvm::StringRef, llvm::SourceMgr&, M::KGEN::LIT::SharedState&, mlir::TimingScope&, llvm::SmallVectorImpl<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>*, llvm::function_ref<M::KGEN::LIT::ASTDecl& (mlir::ModuleOp)>) (/home/jwzeng/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x20292a2)
#16 0x0000557eba36a62d M::KGEN::LIT::importMojoFile(M::LLCL::Runtime&, llvm::SourceMgr&, M::KGEN::LIT::ParserConfig&, mlir::TimingScope&, llvm::SmallVectorImpl<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>*) (/home/jwzeng/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x202962d)
#17 0x0000557eb9e8bb0c mlir::OwningOpRef<mlir::ModuleOp> llvm::function_ref<mlir::OwningOpRef<mlir::ModuleOp> (M::KGEN::LIT::ParserConfig&, mlir::TimingScope&)>::callback_fn<build(M::State const&)::$_2>(long, M::KGEN::LIT::ParserConfig&, mlir::TimingScope&) (/home/jwzeng/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x1b4ab0c)
#18 0x0000557eb9e8e111 M::invokeMojoParser(M::State const&, llvm::opt::InputArgList const&, M::KGEN::CompilationOptions&, mlir::MLIRContext*, M::LLCL::Runtime&, llvm::opt::OptSpecifier, llvm::opt::OptSpecifier, llvm::opt::OptSpecifier, llvm::function_ref<mlir::OwningOpRef<mlir::ModuleOp> (M::KGEN::LIT::ParserConfig&, mlir::TimingScope&)>) (/home/jwzeng/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x1b4d111)
#19 0x0000557eb9e894c9 build(M::State const&) (/home/jwzeng/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x1b484c9)
#20 0x0000557eb9e87ade main (/home/jwzeng/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x1b46ade)
#21 0x00007f5a8f615d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#22 0x00007f5a8f615e40 call_init ./csu/../csu/libc-start.c:128:20
#23 0x00007f5a8f615e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#24 0x0000557eb9e8742e _start (/home/jwzeng/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x1b4642e)
0x557ebcd70238 crashed!
Please file a bug report.
Aborted

System information

$ lsb_release -a
LSB Version:    core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:        22.04
Codename:       jammy
$ mojo -v
mojo 24.2.1 (2f0dcf11)
$ modular -v
modular 0.7.2 (d0adc668)
@junweizeng junweizeng added bug Something isn't working mojo Issues that are related to mojo labels Apr 25, 2024
@ematejska ematejska added the mojo-repo Tag all issues with this label label Apr 29, 2024
@junweizeng
Copy link
Contributor Author

This bug seems to have been fixed on nightly/mojo. The retest process is as follows:

$ cat test.mojo
import object
def main():
$
$ mojo -v
mojo 2024.4.2923 (f54d89e3)
$
$ mojo build test.mojo
/path/to/test.mojo:1:8: error: unable to locate module 'object'
import object
       ^
mojo: error: failed to parse the provided Mojo source module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mojo Issues that are related to mojo mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

2 participants