[llvm-bugs] [Bug 27892] New: [MSVC] _InterlockedIncrement/Decrement builtins crash clang

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 26 06:49:13 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27892

            Bug ID: 27892
           Summary: [MSVC] _InterlockedIncrement/Decrement builtins crash
                    clang
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andreybokhanko at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

_InterlockedIncrement/Decrement builtins crash Clang FE: 

$ cat ~/test.c 
void foo(long *lp) { 
  _InterlockedIncrement(lp); 
} 

$ clang -cc1 -triple x86_64-unknown-unknown -fms-compatibility ~/test.c
-emit-llvm
clang: /export/users/asbokhan/clang_trunk/llvm/lib/IR/Instructions.cpp:1522:
void llvm::AtomicRMWInst::Init(llvm::AtomicRMWInst::BinOp, llvm::Value*,
llvm::Value*, llvm::AtomicOrdering, llvm::SynchronizationScope): Assertion
`getOperand(1)->getType() ==
cast<PointerType>(getOperand(0)->getType())->getElementType() && "Ptr must be a
pointer to Val type!"' failed.
#0 0x0000000002f4314f llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/export/users/asbokhan/clang_trunk/llvm/lib/Support/Unix/Signals.inc:400:0
#1 0x0000000002f434fa PrintStackTraceSignalHandler(void*)
/export/users/asbokhan/clang_trunk/llvm/lib/Support/Unix/Signals.inc:468:0
#2 0x0000000002f419e6 llvm::sys::RunSignalHandlers()
/export/users/asbokhan/clang_trunk/llvm/lib/Support/Signals.cpp:44:0
#3 0x0000000002f42ab7 SignalHandler(int)
/export/users/asbokhan/clang_trunk/llvm/lib/Support/Unix/Signals.inc:254:0
#4 0x00007ff974e10130 __restore_rt (/lib64/libpthread.so.0+0xf130)
#5 0x00007ff9740405d7 __GI_raise (/lib64/libc.so.6+0x355d7)
#6 0x00007ff974041cc8 __GI_abort (/lib64/libc.so.6+0x36cc8)
#7 0x00007ff974039546 __assert_fail_base (/lib64/libc.so.6+0x2e546)
#8 0x00007ff9740395f2 (/lib64/libc.so.6+0x2e5f2)
#9 0x0000000002a242cc llvm::AtomicRMWInst::Init(llvm::AtomicRMWInst::BinOp,
llvm::Value*, llvm::Value*, llvm::AtomicOrdering, llvm::SynchronizationScope)
/export/users/asbokhan/clang_trunk/llvm/lib/IR/Instructions.cpp:1524:0
#10 0x0000000002a24398
llvm::AtomicRMWInst::AtomicRMWInst(llvm::AtomicRMWInst::BinOp, llvm::Value*,
llvm::Value*, llvm::AtomicOrdering, llvm::SynchronizationScope,
llvm::Instruction*)
/export/users/asbokhan/clang_trunk/llvm/lib/IR/Instructions.cpp:1536:0
#11 0x00000000031d9c4f llvm::IRBuilder<llvm::ConstantFolder,
clang::CodeGen::CGBuilderInserter>::CreateAtomicRMW(llvm::AtomicRMWInst::BinOp,
llvm::Value*, llvm::Value*, llvm::AtomicOrdering, llvm::SynchronizationScope)
/export/users/asbokhan/clang_trunk/llvm/include/llvm/IR/IRBuilder.h:1122:0
#12 0x00000000034cb265
clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(clang::FunctionDecl const*,
unsigned int, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/CodeGen/CGBuiltin.cpp:1891:0
#13 0x00000000033e5794
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/CodeGen/CGExpr.cpp:3731:0
#14 0x000000000340e17a (anonymous
namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/CodeGen/CGExprScalar.cpp:326:0
#15 0x000000000341f4ef clang::StmtVisitorBase<clang::make_ptr, (anonymous
namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*)
/export/users/asbokhan/clang_trunk/build/tools/clang/include/clang/AST/StmtNodes.inc:311:0
#16 0x000000000340d7b4 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/CodeGen/CGExprScalar.cpp:205:0
#17 0x000000000341e3b6
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/CodeGen/CGExprScalar.cpp:3450:0
#18 0x00000000033d0df2 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot, bool)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/CodeGen/CGExpr.cpp:144:0
#19 0x00000000033d0d7e
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/CodeGen/CGExpr.cpp:129:0
#20 0x000000000319edd6 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/CodeGen/CGStmt.cpp:109:0
#21 0x000000000319f96c
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/CodeGen/CGStmt.cpp:322:0
#22 0x00000000031f14ee
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:893:0
#23 0x00000000031f1eb3
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:1020:0
#24 0x000000000320b651
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:2883:0
#25 0x0000000003207b77
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:1797:0
#26 0x0000000003206f8a
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:1616:0
#27 0x000000000320f9ea
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:3714:0
#28 0x0000000003a16d72 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/CodeGen/ModuleBuilder.cpp:147:0
#29 0x0000000003a14120
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:120:0
#30 0x00000000042b1971 clang::ParseAST(clang::Sema&, bool, bool)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/Parse/ParseAST.cpp:158:0
#31 0x00000000036295aa clang::ASTFrontendAction::ExecuteAction()
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:558:0
#32 0x0000000003a136b6 clang::CodeGenAction::ExecuteAction()
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:851:0
#33 0x0000000003629051 clang::FrontendAction::Execute()
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:461:0
#34 0x00000000035db91a
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:875:0
#35 0x000000000372266a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:241:0
#36 0x00000000016e352d cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/tools/driver/cc1_main.cpp:116:0
#37 0x00000000016d9d01 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef)
/export/users/asbokhan/clang_trunk/llvm/tools/clang/tools/driver/driver.cpp:301:0
#38 0x00000000016da749 main
/export/users/asbokhan/clang_trunk/llvm/tools/clang/tools/driver/driver.cpp:381:0
#39 0x00007ff97402caf5 __libc_start_main (/lib64/libc.so.6+0x21af5)
#40 0x00000000016d76a9 _start
(/export/users/asbokhan/clang_trunk/build/bin/clang-3.8+0x16d76a9)
Stack dump:
0.      Program arguments: clang -cc1 -triple x86_64-unknown-unknown
-fms-compatibility /nfs/ims/home/asbokhan/test.c -emit-llvm
1.      <eof> parser at end of file
2.      /nfs/ims/home/asbokhan/test.c:1:6: LLVM IR generation of declaration
'foo'
3.      /nfs/ims/home/asbokhan/test.c:1:6: Generating code for declaration
'foo'
Aborted (core dumped)


Yours,
Andrey
=====
Software Engineer
Intel Compiler Team

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160526/235d5d6c/attachment-0001.html>


More information about the llvm-bugs mailing list