[llvm-bugs] [Bug 31954] New: Clang CodeGen fails on struct with atomic members

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 13 16:49:35 PST 2017


http://bugs.llvm.org/show_bug.cgi?id=31954

            Bug ID: 31954
           Summary: Clang CodeGen fails on struct with atomic members
           Product: clang
           Version: 4.0
          Hardware: Macintosh
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: cnweaver at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 17976
  --> http://bugs.llvm.org/attachment.cgi?id=17976&action=edit
Reduced testcase created with CReduce and some manual reduction

Trunk clang hits the following assertion failure when compiling the attached,
reduced testcase:

Assertion failed: (Result.isUninit() && "temporary created multiple times"),
function createTemporary, file
/Users/c/ConstructionZone/llvm/tools/clang/lib/AST/ExprConstant.cpp, line 1094.
0  clang                    0x0000000101af5738
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  clang                    0x0000000101af5e06 SignalHandler(int) + 454
2  libsystem_platform.dylib 0x00000001054705aa _sigtramp + 26
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 4206426736
4  libsystem_c.dylib        0x00000001052acb1a abort + 125
5  libsystem_c.dylib        0x00000001052769bf basename + 0
6  clang                    0x0000000103580ac0 (anonymous
namespace)::CallStackFrame::createTemporary(void const*, bool) + 352
7  clang                    0x000000010356bc20 Evaluate(clang::APValue&,
(anonymous namespace)::EvalInfo&, clang::Expr const*) + 2608
8  clang                    0x0000000103586592
clang::StmtVisitorBase<clang::make_const_ptr, (anonymous
namespace)::AtomicExprEvaluator, bool>::Visit(clang::Stmt const*) + 1234
9  clang                    0x000000010356c10f Evaluate(clang::APValue&,
(anonymous namespace)::EvalInfo&, clang::Expr const*) + 3871
10 clang                    0x00000001035682c0 EvaluateInPlace(clang::APValue&,
(anonymous namespace)::EvalInfo&, (anonymous namespace)::LValue const&,
clang::Expr const*, bool) + 208
11 clang                    0x00000001035b585d
HandleClassZeroInitialization((anonymous namespace)::EvalInfo&, clang::Expr
const*, clang::RecordDecl const*, (anonymous namespace)::LValue const&,
clang::APValue&) + 1693
12 clang                    0x00000001035b27bd (anonymous
namespace)::RecordExprEvaluator::ZeroInitialization(clang::Expr const*,
clang::QualType) + 589
13 clang                    0x00000001035b2cda
clang::StmtVisitorBase<clang::make_const_ptr, (anonymous
namespace)::RecordExprEvaluator, bool>::Visit(clang::Stmt const*) + 506
14 clang                    0x00000001035682b0 EvaluateInPlace(clang::APValue&,
(anonymous namespace)::EvalInfo&, (anonymous namespace)::LValue const&,
clang::Expr const*, bool) + 192
15 clang                    0x0000000103567de6
clang::Expr::EvaluateAsInitializer(clang::APValue&, clang::ASTContext const&,
clang::VarDecl const*,
llvm::SmallVectorImpl<std::__1::pair<clang::SourceLocation,
clang::PartialDiagnostic> >&) const + 934
16 clang                    0x00000001035075aa
clang::VarDecl::evaluateValue(llvm::SmallVectorImpl<std::__1::pair<clang::SourceLocation,
clang::PartialDiagnostic> >&) const + 154
17 clang                    0x000000010350742e clang::VarDecl::evaluateValue()
const + 78
18 clang                    0x0000000101e4ab04
clang::CodeGen::CodeGenModule::EmitConstantInit(clang::VarDecl const&,
clang::CodeGen::CodeGenFunction*) + 260
19 clang                    0x0000000101f653dc
clang::CodeGen::CodeGenModule::EmitGlobalVarDefinition(clang::VarDecl const*,
bool) + 428
20 clang                    0x0000000101f6061f
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 239
21 clang                    0x0000000101f67391
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 337
22 clang                    0x0000000101fee3df (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) + 143
23 clang                    0x0000000101f48faa
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) + 186
24 clang                    0x00000001028eb712 clang::ParseAST(clang::Sema&,
bool, bool) + 370
25 clang                    0x00000001021ba2fc clang::FrontendAction::Execute()
+ 76
26 clang                    0x00000001021765c1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1217
27 clang                    0x000000010221b252
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 4898
28 clang                    0x00000001004828fc cc1_main(llvm::ArrayRef<char
const*>, char const*, void*) + 1388
29 clang                    0x00000001004810a3 main + 11891
30 libdyld.dylib            0x00000001051d45fd start + 1
Stack dump:
0.      Program arguments: /Users/c/ConstructionZone/llvm_build/bin/clang -cc1
-triple x86_64-apple-macosx10.9.0 -emit-obj -disable-free -mrelocation-model
pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose
-munwind-tables -target-linker-version 224.1 -dwarf-column-info
-debugger-tuning=lldb -stdlib=libc++ -O3 -std=c++11 -stack-protector 1
-fcxx-exceptions -fexceptions -fmax-type-align=16 -x c++ atomic_ICE.cpp 
1.      <eof> parser at end of file
2.      atomic_ICE.cpp:10:3: LLVM IR generation of declaration 'g'
3.      atomic_ICE.cpp:10:3: Generating code for declaration 'g'

This seems to stem from the change made in r291480, and so affects the 4.0
release branch as well. It is a regression from earlier versions, which
successfully compiled this testcase and the code from which it was derived.

-- 
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/20170214/644f0f99/attachment-0001.html>


More information about the llvm-bugs mailing list