llvm-project
llvm-project copied to clipboard
Crashes on use of "offset" in inline asm
Example:
char abc[] = "test str";
void __attribute__((naked)) func()
{
__asm
{
push offset abc
}
}
I trying compile it with clang++ test.cpp -masm=intel -fasm-blocks
If I remove "offset" keyword then it will do not crash and compile normal.
Crashlog:
0. Program arguments: /usr/bin/clang-14 -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -mllvm -x86-asm-syntax=intel -inline-asm=intel -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -fcoverage-compilation-dir=/home/marisa -resource-dir /usr/lib/clang/14.0.6 -internal-isystem /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../include/c++/12.1.1 -internal-isystem /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../include/c++/12.1.1/x86_64-pc-linux-gnu -internal-isystem /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../include/c++/12.1.1/backward -internal-isystem /usr/lib/clang/14.0.6/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../x86_64-pc-linux-gnu/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir=/home/marisa -ferror-limit 19 -stack-protector 2 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -fasm-blocks -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/test-867a3a.o -x c++ test.cpp
1. test.cpp:10:1: current parser token '}'
2. test.cpp:5:1: parsing function body 'func'
3. test.cpp:5:1: in compound statement ('{}')
#0 0x00007f24b6f3645a (/usr/lib/libLLVM-14.so+0xcd545a)
#1 0x00007f24b6f33aef llvm::sys::RunSignalHandlers() (/usr/lib/libLLVM-14.so+0xcd2aef)
#2 0x00007f24b6f33c3d (/usr/lib/libLLVM-14.so+0xcd2c3d)
#3 0x00007f24b5e7ba40 (/usr/lib/libc.so.6+0x38a40)
#4 0x00007f24b5f96cd0 (/usr/lib/libc.so.6+0x153cd0)
#5 0x00007f24b6f04ce7 llvm::raw_string_ostream::write_impl(char const*, unsigned long) (/usr/lib/libLLVM-14.so+0xca3ce7)
#6 0x00007f24b6f06f8e llvm::raw_ostream::write(char const*, unsigned long) (/usr/lib/libLLVM-14.so+0xca5f8e)
#7 0x00007f24b8b1a08a (/usr/lib/libLLVM-14.so+0x28b908a)
#8 0x00007f24bdb8dbea clang::Parser::ParseMicrosoftAsmStatement(clang::SourceLocation) (/usr/lib/libclang-cpp.so.14+0x870bea)
#9 0x00007f24bdba04fc clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributesWithRange&) (/usr/lib/libclang-cpp.so.14+0x8834fc)
#10 0x00007f24bdba0cc4 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/lib/libclang-cpp.so.14+0x883cc4)
#11 0x00007f24bdba5a62 clang::Parser::ParseCompoundStatementBody(bool) (/usr/lib/libclang-cpp.so.14+0x888a62)
#12 0x00007f24bdba751a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/usr/lib/libclang-cpp.so.14+0x88a51a)
#13 0x00007f24bdba825b clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/usr/lib/libclang-cpp.so.14+0x88b25b)
#14 0x00007f24bdb2c0e9 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/usr/lib/libclang-cpp.so.14+0x80f0e9)
#15 0x00007f24bdb97478 (/usr/lib/libclang-cpp.so.14+0x87a478)
#16 0x00007f24bdbac6ce clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/usr/lib/libclang-cpp.so.14+0x88f6ce)
#17 0x00007f24bdbaca56 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) (/usr/lib/libclang-cpp.so.14+0x88fa56)
#18 0x00007f24bdaf6e98 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/libclang-cpp.so.14+0x7d9e98)
#19 0x00007f24bf0d09b9 clang::FrontendAction::Execute() (/usr/lib/libclang-cpp.so.14+0x1db39b9)
#20 0x00007f24bf06fe67 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/libclang-cpp.so.14+0x1d52e67)
#21 0x00007f24bf12774a clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/libclang-cpp.so.14+0x1e0a74a)
#22 0x0000557af0c406f1 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang-14+0x176f1)
#23 0x0000557af0c42337 (/usr/bin/clang-14+0x19337)
#24 0x0000557af0c36216 main (/usr/bin/clang-14+0xd216)
#25 0x00007f24b5e662d0 (/usr/lib/libc.so.6+0x232d0)
#26 0x00007f24b5e6638a __libc_start_main (/usr/lib/libc.so.6+0x2338a)
#27 0x0000557af0c38655 _start (/usr/bin/clang-14+0xf655)