[llvm-bugs] [Bug 43370] New: Clang crashes in code generation of builtin atomic operation.

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 19 21:04:50 PDT 2019


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

            Bug ID: 43370
           Summary: Clang crashes in code generation of builtin atomic
                    operation.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Dineshkumar.Bhaskaran at amd.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

clang crashes during the compilation of a test program

compiled using command : clang test.cpp
---------------------------------------
// test.cpp
typedef unsigned long long uint64_t;

template<int UNUSED>
void fun()
{
    uint64_t v[2];
    __atomic_store_n(v, 0, 0);
}

int main()
{
  fun<3>();
}
---------------------------------------

Backtrace and run scritps

0.      Program arguments: /root/clang/bin/clang-10 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
test.cpp -mrelocation-model static -mthread-model posix -mframe-pointer=all
-fmath-errno -masm-verbose -mconstructor-aliases -mun
wind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info
-debugger-tuning=gdb -resource-dir /root/clang/lib/clang/10.0.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0
-internal-isystem /usr/lib/gcc/x86_64-linux-gnu/5.4.0/..
/../../../include/x86_64-linux-gnu/c++/5.4.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward
-internal-isystem /usr/local/inc
lude -internal-isystem /root/clang/lib/clang/10.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir /root/llvm-project/llvm/build
-ferror-
limit 19 -fmessage-length 0 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -faddrsig -o /tmp/test-73c289.o
-x c++ test.cpp
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
3.      test.cpp:5:6: Generating code for declaration 'fun'
 #0 0x0000000002994349 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/root/llvm-project/llvm/lib/Support/Unix/Signals.inc:532:11
 #1 0x00000000029944f9 PrintStackTraceSignalHandler(void*)
/root/llvm-project/llvm/lib/Support/Unix/Signals.inc:593:1
 #2 0x0000000002992dc6 llvm::sys::RunSignalHandlers()
/root/llvm-project/llvm/lib/Support/Signals.cpp:67:5
 #3 0x0000000002994c4b SignalHandler(int)
/root/llvm-project/llvm/lib/Support/Unix/Signals.inc:384:1
 #4 0x00007fec2810d390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
 #5 0x00007fec26ea0428 raise (/lib/x86_64-linux-gnu/libc.so.6+0x35428)
 #6 0x00007fec26ea202a abort (/lib/x86_64-linux-gnu/libc.so.6+0x3702a)
 #7 0x00007fec26e98bd7 (/lib/x86_64-linux-gnu/libc.so.6+0x2dbd7)
 #8 0x00007fec26e98c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
 #9 0x0000000002c989e5 clang::QualType::getCommonPtr() const
/root/llvm-project/llvm/tools/clang/include/clang/AST/Type.h:660:59
#10 0x0000000002c98995 clang::QualType::getTypePtr() const
/root/llvm-project/llvm/tools/clang/include/clang/AST/Type.h:6149:26
#11 0x0000000002c985d5 clang::QualType::operator->() const
/root/llvm-project/llvm/tools/clang/include/clang/AST/Type.h:701:5
#12 0x000000000303ceca
clang::CodeGen::CodeGenFunction::EmitAtomicExpr(clang::AtomicExpr*)
/root/llvm-project/llvm/tools/clang/lib/CodeGen/CGAtomic.cpp:748:40
#13 0x00000000031c9600 (anonymous
namespace)::ScalarExprEmitter::VisitAtomicExpr(clang::AtomicExpr*)
/root/llvm-project/llvm/tools/clang/lib/CodeGen/CGExprScalar.cpp:4422:14
#14 0x00000000031c4734 clang::StmtVisitorBase<std::add_pointer, (anonymous
namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*)
/root/llvm-project/llvm/build/tools/clang/include/clang/AST/StmtNodes.inc:611:1
#15 0x00000000031bb349 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
/root/llvm-project/llvm/tools/clang/lib/CodeGen/CGExprScalar.cpp:425:3
#16 0x00000000031bb293
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
/root/llvm-project/llvm/tools/clang/lib/CodeGen/CGExprScalar.cpp:4435:3
#17 0x0000000003162747 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot, bool)
/root/llvm-project/llvm/tools/clang/lib/CodeGen/CGExpr.cpp:199:12
#18 0x000000000316266d
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
/root/llvm-project/llvm/tools/clang/lib/CodeGen/CGExpr.cpp:184:19
#19 0x0000000002db1030 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
/root/llvm-project/llvm/tools/clang/lib/CodeGen/CGStmt.cpp:114:34
#20 0x0000000002db9120
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
/root/llvm-project/llvm/tools/clang/lib/CodeGen/CGStmt.cpp:390:3
#21 0x0000000002e40e2b
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
/root/llvm-project/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:1042:5
#22 0x0000000002e418ca
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
/root/llvm-project/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:1208:3
#23 0x0000000002e6bc6e
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/root/llvm-project/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:4361:3
#24 0x0000000002e63334
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/root/llvm-project/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:2779:12
#25 0x0000000002e59f3b clang::CodeGen::CodeGenModule::EmitDeferred()
/root/llvm-project/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:2135:10
#26 0x0000000002e585bf clang::CodeGen::CodeGenModule::Release()
/root/llvm-project/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:394:3
#27 0x0000000003e69872 (anonymous
namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&)
/root/llvm-project/llvm/tools/clang/lib/CodeGen/ModuleBuilder.cpp:263:11
#28 0x0000000003e62887
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
/root/llvm-project/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:242:14
#29 0x000000000586613e clang::ParseAST(clang::Sema&, bool, bool)
/root/llvm-project/llvm/tools/clang/lib/Parse/ParseAST.cpp:178:12
#30 0x00000000034e4842 clang::ASTFrontendAction::ExecuteAction()
/root/llvm-project/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:1044:1
#31 0x0000000003e604ce clang::CodeGenAction::ExecuteAction()
/root/llvm-project/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:1089:1
#32 0x00000000034e41f1 clang::FrontendAction::Execute()
/root/llvm-project/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:939:7
#33 0x00000000034796bc
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/root/llvm-project/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:957:23
#34 0x000000000367575f
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/root/llvm-project/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:290:8
#35 0x00000000011a251c cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /root/llvm-project/llvm/tools/clang/tools/driver/cc1_main.cpp:250:13
#36 0x0000000001196761 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef)
/root/llvm-project/llvm/tools/clang/tools/driver/driver.cpp:309:5
#37 0x0000000001195af6 main
/root/llvm-project/llvm/tools/clang/tools/driver/driver.cpp:382:5
#38 0x00007fec26e8b830 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x20830)
#39 0x00000000011952c9 _start (/root/clang/bin/clang-10+0x11952c9)
clang-10: error: unable to execute command: Aborted (core dumped)
clang-10: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 10.0.0 (https://github.com/llvm/llvm-project.git
4aef105b43076e18e2d272a77491adc9533f5f3f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /root/clang/bin
clang-10: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-10: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-10: note: diagnostic msg: /tmp/test-4dac58.cpp
clang-10: note: diagnostic msg: /tmp/test-4dac58.sh
clang-10: note: diagnostic msg:


root at hostname:~# cat /tmp/test-4dac58.cpp
# 1 "<built-in>"
# 1 "test.cpp"
// test.cpp
typedef unsigned long long uint64_t;

template<int UNUSED>
void fun()
{
    uint64_t v[2];
    __atomic_store_n(v, 0, 0);
}

int main()
{
  fun<3>();
}

root at hostname:~# cat /tmp/test-4dac58.sh
# Crash reproducer for clang version 10.0.0
(https://github.com/llvm/llvm-project.git
4aef105b43076e18e2d272a77491adc9533f5f3f)
# Driver args: "test.cpp"
# Original command:  "/root/clang/bin/clang-10" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-main-file-name" "test.cpp" "-mrelocation-model" "static" "-mthread-model"
"posix" "-mframe-pointer=all" "-fmath-errno" "-masm-verbose"
"-mconstructor-aliases" "-munwind-tables" "-fuse-init-array" "-target-cpu"
"x86-64" "-dwarf-column-info" "-debugger-tuning=gdb" "-resource-dir"
"/root/clang/lib/clang/10.0.0" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0" "-intern
al-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0"
"-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../
include/c++/5.4.0/backward" "-internal-isystem" "/usr/local/include"
"-internal-isystem" "/root/clang/lib/clang/10.0.0/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "
-fdeprecated-macro" "-fdebug-compilation-dir" "/root/llvm-project/llvm/build"
"-ferror-limit" "19" "-fmessage-length" "0" "-fobjc-runtime=gcc"
"-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option"
"-fcolor-diagnostics" "-faddrsig" "-o" "/tmp/test-73c289.o" "-x" "
c++" "test.cpp"
 "/root/clang/bin/clang-10" "-cc1" "-triple" "x86_64-unknown-linux-gnu"
"-emit-obj" "-mrelax-all" "-disable-free" "-main-file-name" "test.cpp"
"-mrelocation-model" "static" "-mthread-model" "posix" "-mframe-pointer=all"
"-fmath-errno" "-masm-verbose" "-mconstructor-alias
es" "-munwind-tables" "-fuse-init-array" "-target-cpu" "x86-64"
"-dwarf-column-info" "-debugger-tuning=gdb" "-fdeprecated-macro"
"-ferror-limit" "19" "-fmessage-length" "0" "-fobjc-runtime=gcc"
"-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option" "-fcolor-diagno
stics" "-faddrsig" "-x" "c++" "test-4dac58.cpp"

-- 
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/20190920/37d74553/attachment-0001.html>


More information about the llvm-bugs mailing list