[llvm-bugs] [Bug 36567] New: Crash in getTypeInfoImpl

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 1 21:06:11 PST 2018


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

            Bug ID: 36567
           Summary: Crash in getTypeInfoImpl
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: arthur.j.odwyer at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 19981
  --> https://bugs.llvm.org/attachment.cgi?id=19981&action=edit
Compile with clang++ -std=c++14 to reproduce the crash

Wandbox demo:
- https://wandbox.org/permlink/2kLUK01z5Dmr6Brl

This is a possible duplicate of:
- https://bugs.llvm.org/show_bug.cgi?id=32643
- https://bugs.llvm.org/show_bug.cgi?id=25257


On my MacBook, Xcode crashes like this:
```
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to
http://developer.apple.com/bugreporter/ and include the crash backtrace,
preprocessed source, and associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg:
/var/folders/1z/jvnkrdws621c6wmrcf7q_9180000gn/T/z-62e58e.cpp
clang: note: diagnostic msg:
/var/folders/1z/jvnkrdws621c6wmrcf7q_9180000gn/T/z-62e58e.sh
clang: note: diagnostic msg: 

********************
```

On Wandbox, Clang crashes like this, with a helpful stack trace:
```
[...]
prog.cc:457:5: note: candidate constructor not viable: no known conversion from
'auto' to 'nonstd::future<int> &&' for 1st argument
    future(future&&) noexcept = default;
    ^
#0 0x0000000001b7a9f4 PrintStackTraceSignalHandler(void*)
(/opt/wandbox/clang-head/bin/clang-7.0+0x1b7a9f4)
#1 0x0000000001b7acc6 SignalHandler(int)
(/opt/wandbox/clang-head/bin/clang-7.0+0x1b7acc6)
#2 0x00007f9c23a03390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#3 0x0000000003395899 clang::ASTContext::getTypeInfoImpl(clang::Type const*)
const (/opt/wandbox/clang-head/bin/clang-7.0+0x3395899)
#4 0x00000000033965ca clang::ASTContext::getTypeInfo(clang::Type const*) const
(/opt/wandbox/clang-head/bin/clang-7.0+0x33965ca)
#5 0x00000000033964ab clang::ASTContext::getTypeInfoInChars(clang::Type const*)
const (/opt/wandbox/clang-head/bin/clang-7.0+0x33964ab)
#6 0x00000000035499d0 (anonymous
namespace)::ItaniumRecordLayoutBuilder::LayoutField(clang::FieldDecl const*,
bool) (/opt/wandbox/clang-head/bin/clang-7.0+0x35499d0)
#7 0x00000000035459d5 (anonymous
namespace)::ItaniumRecordLayoutBuilder::LayoutFields(clang::RecordDecl const*)
(/opt/wandbox/clang-head/bin/clang-7.0+0x35459d5)
#8 0x000000000353f852 clang::ASTContext::getASTRecordLayout(clang::RecordDecl
const*) const (/opt/wandbox/clang-head/bin/clang-7.0+0x353f852)
#9 0x0000000003395bca clang::ASTContext::getTypeInfoImpl(clang::Type const*)
const (/opt/wandbox/clang-head/bin/clang-7.0+0x3395bca)
#10 0x00000000033965ca clang::ASTContext::getTypeInfo(clang::Type const*) const
(/opt/wandbox/clang-head/bin/clang-7.0+0x33965ca)
#11 0x0000000003395a64 clang::ASTContext::getTypeInfoImpl(clang::Type const*)
const (/opt/wandbox/clang-head/bin/clang-7.0+0x3395a64)
#12 0x00000000033965ca clang::ASTContext::getTypeInfo(clang::Type const*) const
(/opt/wandbox/clang-head/bin/clang-7.0+0x33965ca)
#13 0x00000000033964ab clang::ASTContext::getTypeInfoInChars(clang::Type
const*) const (/opt/wandbox/clang-head/bin/clang-7.0+0x33964ab)
#14 0x00000000034c807f HandleSizeof((anonymous namespace)::EvalInfo&,
clang::SourceLocation, clang::QualType, clang::CharUnits&)
(/opt/wandbox/clang-head/bin/clang-7.0+0x34c807f)
#15 0x00000000034d2d93 clang::StmtVisitorBase<clang::make_const_ptr, (anonymous
namespace)::IntExprEvaluator, bool>::Visit(clang::Stmt const*)
(/opt/wandbox/clang-head/bin/clang-7.0+0x34d2d93)
#16 0x00000000034ba960 Evaluate(clang::APValue&, (anonymous
namespace)::EvalInfo&, clang::Expr const*)
(/opt/wandbox/clang-head/bin/clang-7.0+0x34ba960)
#17 0x00000000034b6edd EvaluateAsRValue((anonymous namespace)::EvalInfo&,
clang::Expr const*, clang::APValue&)
(/opt/wandbox/clang-head/bin/clang-7.0+0x34b6edd)
#18 0x00000000034b9f5a clang::Expr::isCXX11ConstantExpr(clang::ASTContext
const&, clang::APValue*, clang::SourceLocation*) const
(/opt/wandbox/clang-head/bin/clang-7.0+0x34b9f5a)
#19 0x00000000034b8e57
EvaluateCPlusPlus11IntegralConstantExpr(clang::ASTContext const&, clang::Expr
const*, llvm::APSInt*, clang::SourceLocation*)
(/opt/wandbox/clang-head/bin/clang-7.0+0x34b8e57)
#20 0x00000000034b9d73 clang::Expr::isIntegerConstantExpr(llvm::APSInt&,
clang::ASTContext const&, clang::SourceLocation*, bool) const
(/opt/wandbox/clang-head/bin/clang-7.0+0x34b9d73)
#21 0x0000000002d890cf AnalyzeImplicitConversions(clang::Sema&, clang::Expr*,
clang::SourceLocation) (/opt/wandbox/clang-head/bin/clang-7.0+0x2d890cf)
#22 0x0000000002d8930a AnalyzeImplicitConversions(clang::Sema&, clang::Expr*,
clang::SourceLocation) (/opt/wandbox/clang-head/bin/clang-7.0+0x2d8930a)
#23 0x0000000002d8930a AnalyzeImplicitConversions(clang::Sema&, clang::Expr*,
clang::SourceLocation) (/opt/wandbox/clang-head/bin/clang-7.0+0x2d8930a)
#24 0x0000000002d8c104 clang::Sema::CheckCompletedExpr(clang::Expr*,
clang::SourceLocation, bool) (/opt/wandbox/clang-head/bin/clang-7.0+0x2d8c104)
#25 0x0000000003017bc3 clang::Sema::ActOnFinishFullExpr(clang::Expr*,
clang::SourceLocation, bool, bool, bool)
(/opt/wandbox/clang-head/bin/clang-7.0+0x3017bc3)
#26 0x000000000317d31e clang::Sema::BuildReturnStmt(clang::SourceLocation,
clang::Expr*) (/opt/wandbox/clang-head/bin/clang-7.0+0x317d31e)
#27 0x000000000324f8d1 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*,
bool) (/opt/wandbox/clang-head/bin/clang-7.0+0x324f8d1)
#28 0x000000000323caf1 clang::Sema::SubstStmt(clang::Stmt*,
clang::MultiLevelTemplateArgumentList const&)
(/opt/wandbox/clang-head/bin/clang-7.0+0x323caf1)
#29 0x000000000326cdb9
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool, bool)
(/opt/wandbox/clang-head/bin/clang-7.0+0x326cdb9)
#30 0x0000000002fc0364
clang::Sema::MarkFunctionReferenced(clang::SourceLocation,
clang::FunctionDecl*, bool) (/opt/wandbox/clang-head/bin/clang-7.0+0x2fc0364)
#31 0x0000000002fc3c47 MarkExprReferenced(clang::Sema&, clang::SourceLocation,
clang::Decl*, clang::Expr*, bool)
(/opt/wandbox/clang-head/bin/clang-7.0+0x2fc3c47)
#32 0x000000000314c1f7
clang::Sema::FixOverloadedFunctionReference(clang::Expr*,
clang::DeclAccessPair, clang::FunctionDecl*)
(/opt/wandbox/clang-head/bin/clang-7.0+0x314c1f7)
#33 0x000000000314d997 FinishOverloadedCallExpr(clang::Sema&, clang::Scope*,
clang::Expr*, clang::UnresolvedLookupExpr*, clang::SourceLocation,
llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*,
clang::OverloadCandidateSet*, clang::OverloadCandidate**,
clang::OverloadingResult, bool)
(/opt/wandbox/clang-head/bin/clang-7.0+0x314d997)
#34 0x000000000314d898 clang::Sema::BuildOverloadedCallExpr(clang::Scope*,
clang::Expr*, clang::UnresolvedLookupExpr*, clang::SourceLocation,
llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool,
bool) (/opt/wandbox/clang-head/bin/clang-7.0+0x314d898)
#35 0x0000000002f818dc clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*,
clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation, clang::Expr*, bool)
(/opt/wandbox/clang-head/bin/clang-7.0+0x2f818dc)
#36 0x0000000003243a98 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCallExpr(clang::CallExpr*)
(/opt/wandbox/clang-head/bin/clang-7.0+0x3243a98)
#37 0x00000000032565a8 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCondition(clang::SourceLocation,
clang::VarDecl*, clang::Expr*, clang::Sema::ConditionKind)
(/opt/wandbox/clang-head/bin/clang-7.0+0x32565a8)
#38 0x0000000003254089 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformIfStmt(clang::IfStmt*)
(/opt/wandbox/clang-head/bin/clang-7.0+0x3254089)
#39 0x000000000324f8d1 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*,
bool) (/opt/wandbox/clang-head/bin/clang-7.0+0x324f8d1)
#40 0x000000000323caf1 clang::Sema::SubstStmt(clang::Stmt*,
clang::MultiLevelTemplateArgumentList const&)
(/opt/wandbox/clang-head/bin/clang-7.0+0x323caf1)
#41 0x000000000326cdb9
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool, bool)
(/opt/wandbox/clang-head/bin/clang-7.0+0x326cdb9)
#42 0x000000000326f44f clang::Sema::PerformPendingInstantiations(bool)
(/opt/wandbox/clang-head/bin/clang-7.0+0x326f44f)
#43 0x000000000326cf46
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool, bool)
(/opt/wandbox/clang-head/bin/clang-7.0+0x326cf46)
#44 0x000000000326f44f clang::Sema::PerformPendingInstantiations(bool)
(/opt/wandbox/clang-head/bin/clang-7.0+0x326f44f)
#45 0x000000000326cf46
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool, bool)
(/opt/wandbox/clang-head/bin/clang-7.0+0x326cf46)
#46 0x000000000326f44f clang::Sema::PerformPendingInstantiations(bool)
(/opt/wandbox/clang-head/bin/clang-7.0+0x326f44f)
#47 0x0000000002d402fb clang::Sema::ActOnEndOfTranslationUnit()
(/opt/wandbox/clang-head/bin/clang-7.0+0x2d402fb)
#48 0x0000000002b0d2ca
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/opt/wandbox/clang-head/bin/clang-7.0+0x2b0d2ca)
#49 0x0000000002b08a57 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/wandbox/clang-head/bin/clang-7.0+0x2b08a57)
#50 0x00000000020d6d9f clang::FrontendAction::Execute()
(/opt/wandbox/clang-head/bin/clang-7.0+0x20d6d9f)
#51 0x0000000002096f08
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/wandbox/clang-head/bin/clang-7.0+0x2096f08)
#52 0x000000000216628d
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/wandbox/clang-head/bin/clang-7.0+0x216628d)
#53 0x0000000000899b5b cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/wandbox/clang-head/bin/clang-7.0+0x899b5b)
#54 0x0000000000898848 main (/opt/wandbox/clang-head/bin/clang-7.0+0x898848)
#55 0x00007f9c22772830 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x20830)
#56 0x00000000008957e9 _start (/opt/wandbox/clang-head/bin/clang-7.0+0x8957e9)
Stack dump:
0.      Program arguments: /opt/wandbox/clang-head/bin/clang-7.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name prog.cc
-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 -debugger-tuning=gdb -nostdinc++
-resource-dir /opt/wandbox/clang-head/lib/clang/7.0.0 -I
/opt/wandbox/clang-head/include/c++/v1 -I /opt/wandbox/boost-sml/include -I
/opt/wandbox/boost-di/include -I /opt/wandbox/range-v3/include -I
/opt/wandbox/nlohmann-json/src -I /opt/wandbox/cmcstl2/include -D
BOOST_NO_AUTO_PTR -I /opt/wandbox/boost-1.66.0/clang-head/include
-internal-isystem /usr/local/include -internal-isystem
/opt/wandbox/clang-head/lib/clang/7.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -Wall -Wextra -std=c++17
-fdeprecated-macro -fdebug-compilation-dir /home/jail -ferror-limit 19
-fmessage-length 0 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -fansi-escape-codes -o
/tmp/prog-16513f.o -x c++ prog.cc 
1.      <eof> parser at end of file
2.      prog.cc:116:5: instantiating function definition
'nonstd::unique_function<void ()>::unique_function<(lambda at prog.cc:475:33),
(lambda at prog.cc:475:33), void>'
3.      prog.cc:83:8: instantiating function definition
'nonstd::unique_function<void ()>::emplace<(lambda at prog.cc:475:33), (lambda
at prog.cc:475:33)>'
4.      prog.cc:47:10: instantiating function definition
'nonstd::unique_function_impl_storage::emplace<(lambda at prog.cc:475:33),
(lambda at prog.cc:475:33)>'
5.      prog.cc:31:27: instantiating function definition
'nonstd::unique_function_impl_storage::fits_inline<(lambda at prog.cc:475:33)>'
clang-7.0: error: unable to execute command: Segmentation fault
clang-7.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0 (https://github.com/llvm-mirror/clang.git
cda70934adc43ab3aed73118809a6d5213119251)
(https://github.com/llvm-mirror/llvm.git
e24854a562277c6e480df6d50abffb405c876f91)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/wandbox/clang-head/bin
clang-7.0: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
[...]
```

-- 
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/20180302/0580c74e/attachment-0001.html>


More information about the llvm-bugs mailing list