llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

clang crash while parsing a struct in C

Open nzaghen opened this issue 7 years ago • 2 comments

Bugzilla Link 41957
Version trunk
OS Linux
Attachments Reduced testcase for the crash
CC @DougGregor,@ecnelises,@zygoloid

Extended Description

The expected result would be clang complaining about "__packed" (which would lead to a missing include). This issue was introduced after LLVM 3.7 and is still present in latest clang trunk.

I attached a manually reduced testcase. https://godbolt.org/z/jdmr5k

Stack dump:

0.	Program arguments: /opt/compiler-explorer/clang-trunk-20190521/bin/clang-9 -cc1 -triple x86_64-unknown-linux-gnu -S -disable-free -disable-llvm-verifier -discard-value-names -main-file-name example.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -coverage-notes-file /home/ubuntu/./output.gcno -resource-dir /opt/compiler-explorer/clang-trunk-20190521/lib/clang/9.0.0 -internal-isystem /usr/local/include -internal-isystem /opt/compiler-explorer/clang-trunk-20190521/lib/clang/9.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /home/ubuntu -ferror-limit 19 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -mllvm --x86-asm-syntax=intel -o ./output.s -x c <source> -faddrsig 

1.	<source>:14:8: current parser token ';'

2.	<source>:2:1: parsing function body 'test'

3.	<source>:2:1: in compound statement ('{}')

4.	<source>:12:2: parsing struct/union body

 #&#8203;0 0x00005616d7606cba llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x269bcba)

 #&#8203;1 0x00005616d7604a84 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x2699a84)

 #&#8203;2 0x00005616d7604bc2 SignalHandler(int) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x2699bc2)

 #&#8203;3 0x00007f146901f890 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)

 #&#8203;4 0x00005616d9398be1 clang::DeclContext::addHiddenDecl(clang::Decl*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x442dbe1)

 #&#8203;5 0x00005616d939ce79 clang::DeclContext::addDecl(clang::Decl*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x4431e79)

 #&#8203;6 0x00005616d8c9e06c clang::Sema::PushOnScopeChains(clang::NamedDecl*, clang::Scope*, bool) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3d3306c)

 #&#8203;7 0x00005616d8cb3cb0 clang::Sema::HandleField(clang::Scope*, clang::RecordDecl*, clang::SourceLocation, clang::Declarator&, clang::Expr*, clang::InClassInitStyle, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3d48cb0)

 #&#8203;8 0x00005616d8cb3fdd clang::Sema::ActOnField(clang::Scope*, clang::Decl*, clang::SourceLocation, clang::Declarator&, clang::Expr*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3d48fdd)

 #&#8203;9 0x00005616d8aed736 void llvm::function_ref<void (clang::ParsingFieldDeclarator&)>::callback_fn<clang::Parser::ParseStructUnionBody(clang::SourceLocation, unsigned int, clang::Decl*)::'lambda'(clang::ParsingFieldDeclarator&)>(long, clang::ParsingFieldDeclarator&) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b82736)

#&#8203;10 0x00005616d8b05b65 clang::Parser::ParseStructDeclaration(clang::ParsingDeclSpec&, llvm::function_ref<void (clang::ParsingFieldDeclarator&)>) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b9ab65)

#&#8203;11 0x00005616d8b09c15 clang::Parser::ParseStructUnionBody(clang::SourceLocation, unsigned int, clang::Decl*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b9ec15)

#&#8203;12 0x00005616d8b1c32c clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::Parser::ParsedAttributesWithRange&) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3bb132c)

#&#8203;13 0x00005616d8afe18e clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b9318e)

#&#8203;14 0x00005616d8b06494 clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, bool, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b9b494)

#&#8203;15 0x00005616d8b067fa clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b9b7fa)

#&#8203;16 0x00005616d8b6c4c2 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3c014c2)

#&#8203;17 0x00005616d8b6daf9 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3c02af9)

#&#8203;18 0x00005616d8b71121 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3c06121)

#&#8203;19 0x00005616d8b741e3 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3c091e3)

#&#8203;20 0x00005616d8ae1b68 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b76b68)

#&#8203;21 0x00005616d8b02381 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b97381)

#&#8203;22 0x00005616d8adcad9 clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b71ad9)

#&#8203;23 0x00005616d8add7b1 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.207) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b727b1)

#&#8203;24 0x00005616d8ae4a06 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b79a06)

#&#8203;25 0x00005616d8ae5469 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b7a469)

#&#8203;26 0x00005616d8ae5995 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b7a995)

#&#8203;27 0x00005616d8ad9246 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b6e246)

#&#8203;28 0x00005616d832c017 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x33c1017)

#&#8203;29 0x00005616d7cc8826 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x2d5d826)

#&#8203;30 0x00005616d7c8b41c clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x2d2041c)

#&#8203;31 0x00005616d7d86eb3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x2e1beb3)

#&#8203;32 0x00005616d5bf9d90 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0xc8ed90)

#&#8203;33 0x00005616d5b5c3b2 main (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0xbf13b2)

#&#8203;34 0x00007f1467eddb97 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b97)

#&#8203;35 0x00005616d5bf738a _start (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0xc8c38a)

clang-9: error: unable to execute command: Segmentation fault (core dumped)

clang-9: error: clang frontend command failed due to signal (use -v to see invocation)

Compiler returned: 254

nzaghen avatar May 21 '19 12:05 nzaghen

assigned to @ecnelises

nzaghen avatar May 21 '19 12:05 nzaghen

@llvm/issue-subscribers-clang-frontend

Author: Nicola Zaghen (nzaghen)

| | | | --- | --- | | Bugzilla Link | [41957](https://llvm.org/bz41957) | | Version | trunk | | OS | Linux | | Attachments | [Reduced testcase for the crash](https://user-images.githubusercontent.com/1748238/143759234-37468778-3fcb-436d-b275-697e9fc2afc1.gz) | | CC | @DougGregor,@ecnelises,@zygoloid |

Extended Description

The expected result would be clang complaining about "__packed" (which would lead to a missing include). This issue was introduced after LLVM 3.7 and is still present in latest clang trunk.

I attached a manually reduced testcase. https://godbolt.org/z/jdmr5k

Stack dump:

0.	Program arguments: /opt/compiler-explorer/clang-trunk-20190521/bin/clang-9 -cc1 -triple x86_64-unknown-linux-gnu -S -disable-free -disable-llvm-verifier -discard-value-names -main-file-name example.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -coverage-notes-file /home/ubuntu/./output.gcno -resource-dir /opt/compiler-explorer/clang-trunk-20190521/lib/clang/9.0.0 -internal-isystem /usr/local/include -internal-isystem /opt/compiler-explorer/clang-trunk-20190521/lib/clang/9.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /home/ubuntu -ferror-limit 19 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -mllvm --x86-asm-syntax=intel -o ./output.s -x c &lt;source&gt; -faddrsig 

1.	&lt;source&gt;:14:8: current parser token ';'

2.	&lt;source&gt;:2:1: parsing function body 'test'

3.	&lt;source&gt;:2:1: in compound statement ('{}')

4.	&lt;source&gt;:12:2: parsing struct/union body

 #&amp;#<!-- -->8203;0 0x00005616d7606cba llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x269bcba)

 #&amp;#<!-- -->8203;1 0x00005616d7604a84 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x2699a84)

 #&amp;#<!-- -->8203;2 0x00005616d7604bc2 SignalHandler(int) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x2699bc2)

 #&amp;#<!-- -->8203;3 0x00007f146901f890 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)

 #&amp;#<!-- -->8203;4 0x00005616d9398be1 clang::DeclContext::addHiddenDecl(clang::Decl*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x442dbe1)

 #&amp;#<!-- -->8203;5 0x00005616d939ce79 clang::DeclContext::addDecl(clang::Decl*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x4431e79)

 #&amp;#<!-- -->8203;6 0x00005616d8c9e06c clang::Sema::PushOnScopeChains(clang::NamedDecl*, clang::Scope*, bool) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3d3306c)

 #&amp;#<!-- -->8203;7 0x00005616d8cb3cb0 clang::Sema::HandleField(clang::Scope*, clang::RecordDecl*, clang::SourceLocation, clang::Declarator&amp;, clang::Expr*, clang::InClassInitStyle, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3d48cb0)

 #&amp;#<!-- -->8203;8 0x00005616d8cb3fdd clang::Sema::ActOnField(clang::Scope*, clang::Decl*, clang::SourceLocation, clang::Declarator&amp;, clang::Expr*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3d48fdd)

 #&amp;#<!-- -->8203;9 0x00005616d8aed736 void llvm::function_ref&lt;void (clang::ParsingFieldDeclarator&amp;)&gt;::callback_fn&lt;clang::Parser::ParseStructUnionBody(clang::SourceLocation, unsigned int, clang::Decl*)::'lambda'(clang::ParsingFieldDeclarator&amp;)&gt;(long, clang::ParsingFieldDeclarator&amp;) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b82736)

#&amp;#<!-- -->8203;10 0x00005616d8b05b65 clang::Parser::ParseStructDeclaration(clang::ParsingDeclSpec&amp;, llvm::function_ref&lt;void (clang::ParsingFieldDeclarator&amp;)&gt;) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b9ab65)

#&amp;#<!-- -->8203;11 0x00005616d8b09c15 clang::Parser::ParseStructUnionBody(clang::SourceLocation, unsigned int, clang::Decl*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b9ec15)

#&amp;#<!-- -->8203;12 0x00005616d8b1c32c clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&amp;, clang::Parser::ParsedTemplateInfo const&amp;, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::Parser::ParsedAttributesWithRange&amp;) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3bb132c)

#&amp;#<!-- -->8203;13 0x00005616d8afe18e clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&amp;, clang::Parser::ParsedTemplateInfo const&amp;, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b9318e)

#&amp;#<!-- -->8203;14 0x00005616d8b06494 clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&amp;, clang::Parser::ParsedAttributesWithRange&amp;, bool, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b9b494)

#&amp;#<!-- -->8203;15 0x00005616d8b067fa clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&amp;, clang::Parser::ParsedAttributesWithRange&amp;) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b9b7fa)

#&amp;#<!-- -->8203;16 0x00005616d8b6c4c2 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector&lt;clang::Stmt*, 32u&gt;&amp;, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&amp;) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3c014c2)

#&amp;#<!-- -->8203;17 0x00005616d8b6daf9 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector&lt;clang::Stmt*, 32u&gt;&amp;, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3c02af9)

#&amp;#<!-- -->8203;18 0x00005616d8b71121 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3c06121)

#&amp;#<!-- -->8203;19 0x00005616d8b741e3 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&amp;) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3c091e3)

#&amp;#<!-- -->8203;20 0x00005616d8ae1b68 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&amp;, clang::Parser::ParsedTemplateInfo const&amp;, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b76b68)

#&amp;#<!-- -->8203;21 0x00005616d8b02381 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&amp;, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b97381)

#&amp;#<!-- -->8203;22 0x00005616d8adcad9 clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&amp;, clang::ParsingDeclSpec&amp;, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b71ad9)

#&amp;#<!-- -->8203;23 0x00005616d8add7b1 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&amp;, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.207) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b727b1)

#&amp;#<!-- -->8203;24 0x00005616d8ae4a06 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&amp;, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b79a06)

#&amp;#<!-- -->8203;25 0x00005616d8ae5469 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&lt;clang::DeclGroupRef&gt;&amp;, bool) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b7a469)

#&amp;#<!-- -->8203;26 0x00005616d8ae5995 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr&lt;clang::DeclGroupRef&gt;&amp;) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b7a995)

#&amp;#<!-- -->8203;27 0x00005616d8ad9246 clang::ParseAST(clang::Sema&amp;, bool, bool) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x3b6e246)

#&amp;#<!-- -->8203;28 0x00005616d832c017 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x33c1017)

#&amp;#<!-- -->8203;29 0x00005616d7cc8826 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x2d5d826)

#&amp;#<!-- -->8203;30 0x00005616d7c8b41c clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x2d2041c)

#&amp;#<!-- -->8203;31 0x00005616d7d86eb3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0x2e1beb3)

#&amp;#<!-- -->8203;32 0x00005616d5bf9d90 cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0xc8ed90)

#&amp;#<!-- -->8203;33 0x00005616d5b5c3b2 main (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0xbf13b2)

#&amp;#<!-- -->8203;34 0x00007f1467eddb97 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b97)

#&amp;#<!-- -->8203;35 0x00005616d5bf738a _start (/opt/compiler-explorer/clang-trunk-20190521/bin/clang-9+0xc8c38a)

clang-9: error: unable to execute command: Segmentation fault (core dumped)

clang-9: error: clang frontend command failed due to signal (use -v to see invocation)

Compiler returned: 254

llvmbot avatar Nov 06 '23 04:11 llvmbot