[llvm-bugs] [Bug 32955] New: Crash in infinite loop trying to find a proper constructor

via llvm-bugs llvm-bugs at lists.llvm.org
Sun May 7 07:52:56 PDT 2017


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

            Bug ID: 32955
           Summary: Crash in infinite loop trying to find a proper
                    constructor
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: v.reichelt at netcologne.de
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

The following invalid code snippet triggers an ICE with LLVM 4.0.0:

=================
struct B;

struct A
{
  A(A&);
  A(B);
};

struct B
{
  B(A);
};

A foo();

A a(foo());
=================

The compiler goes into an infinite loop and finally crashes.
I can reproduce the crash since at least LLVM 3.4.0.

Here's the stack trace:

#0 0x0000000001de12b5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/LLVM-4.0.0/bin/clang-4.0+0x1de12b5)
#1 0x0000000001ddf32e llvm::sys::RunSignalHandlers()
(/home/LLVM-4.0.0/bin/clang-4.0+0x1ddf32e)
#2 0x0000000001ddf492 SignalHandler(int)
(/home/LLVM-4.0.0/bin/clang-4.0+0x1ddf492)
#3 0x00007ffbe32bb870 __restore_rt (/lib64/libpthread.so.0+0xf870)
#4 0x0000000002de0169
clang::Sema::PerformCopyInitialization(clang::InitializedEntity const&,
clang::SourceLocation, clang::ActionResult<clang::Expr*, true>, bool, bool)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2de0169)
#5 0x0000000002d33e73
clang::Sema::GatherArgumentsForCall(clang::SourceLocation,
clang::FunctionDecl*, clang::FunctionProtoType const*, unsigned int,
llvm::ArrayRef<clang::Expr*>, llvm::SmallVectorImpl<clang::Expr*>&,
clang::Sema::VariadicCallType, bool, bool)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2d33e73)
#6 0x0000000002c7d1fd
clang::Sema::CompleteConstructorCall(clang::CXXConstructorDecl*,
llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation,
llvm::SmallVectorImpl<clang::Expr*>&, bool, bool)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2c7d1fd)
#7 0x0000000002dde108 clang::InitializationSequence::Perform(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, clang::QualType*)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2dde108)
#8 0x0000000002de0237
clang::Sema::PerformCopyInitialization(clang::InitializedEntity const&,
clang::SourceLocation, clang::ActionResult<clang::Expr*, true>, bool, bool)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2de0237)
#9 0x0000000002d33e73
clang::Sema::GatherArgumentsForCall(clang::SourceLocation,
clang::FunctionDecl*, clang::FunctionProtoType const*, unsigned int,
llvm::ArrayRef<clang::Expr*>, llvm::SmallVectorImpl<clang::Expr*>&,
clang::Sema::VariadicCallType, bool, bool)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2d33e73)
#10 0x0000000002c7d1fd
clang::Sema::CompleteConstructorCall(clang::CXXConstructorDecl*,
llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation,
llvm::SmallVectorImpl<clang::Expr*>&, bool, bool)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2c7d1fd)
#11 0x0000000002dcf8c2 PerformConstructorInitialization(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, clang::InitializationSequence::Step
const&, bool&, bool, bool, clang::SourceLocation, clang::SourceLocation)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2dcf8c2)
#12 0x0000000002ddd416 clang::InitializationSequence::Perform(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, clang::QualType*)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2ddd416)
#13 0x0000000002de0237
clang::Sema::PerformCopyInitialization(clang::InitializedEntity const&,
clang::SourceLocation, clang::ActionResult<clang::Expr*, true>, bool, bool)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2de0237)
#14 0x0000000002d33e73
clang::Sema::GatherArgumentsForCall(clang::SourceLocation,
clang::FunctionDecl*, clang::FunctionProtoType const*, unsigned int,
llvm::ArrayRef<clang::Expr*>, llvm::SmallVectorImpl<clang::Expr*>&,
clang::Sema::VariadicCallType, bool, bool)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2d33e73)
#15 0x0000000002c7d1fd
clang::Sema::CompleteConstructorCall(clang::CXXConstructorDecl*,
llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation,
llvm::SmallVectorImpl<clang::Expr*>&, bool, bool)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2c7d1fd)
#16 0x0000000002dde108 clang::InitializationSequence::Perform(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, clang::QualType*)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2dde108)
#17 0x0000000002de0237
clang::Sema::PerformCopyInitialization(clang::InitializedEntity const&,
clang::SourceLocation, clang::ActionResult<clang::Expr*, true>, bool, bool)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2de0237)
#18 0x0000000002d33e73
clang::Sema::GatherArgumentsForCall(clang::SourceLocation,
clang::FunctionDecl*, clang::FunctionProtoType const*, unsigned int,
llvm::ArrayRef<clang::Expr*>, llvm::SmallVectorImpl<clang::Expr*>&,
clang::Sema::VariadicCallType, bool, bool)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2d33e73)
#19 0x0000000002c7d1fd
clang::Sema::CompleteConstructorCall(clang::CXXConstructorDecl*,
llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation,
llvm::SmallVectorImpl<clang::Expr*>&, bool, bool)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2c7d1fd)
#20 0x0000000002dcf8c2 PerformConstructorInitialization(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, clang::InitializationSequence::Step
const&, bool&, bool, bool, clang::SourceLocation, clang::SourceLocation)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2dcf8c2)
#21 0x0000000002ddd416 clang::InitializationSequence::Perform(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, clang::QualType*)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2ddd416)
#22 0x0000000002de0237
clang::Sema::PerformCopyInitialization(clang::InitializedEntity const&,
clang::SourceLocation, clang::ActionResult<clang::Expr*, true>, bool, bool)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2de0237)
#23 0x0000000002d33e73
clang::Sema::GatherArgumentsForCall(clang::SourceLocation,
clang::FunctionDecl*, clang::FunctionProtoType const*, unsigned int,
llvm::ArrayRef<clang::Expr*>, llvm::SmallVectorImpl<clang::Expr*>&,
clang::Sema::VariadicCallType, bool, bool)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2d33e73)
#24 0x0000000002c7d1fd
clang::Sema::CompleteConstructorCall(clang::CXXConstructorDecl*,
llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation,
llvm::SmallVectorImpl<clang::Expr*>&, bool, bool)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2c7d1fd)
#25 0x0000000002dde108 clang::InitializationSequence::Perform(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, clang::QualType*)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2dde108)
#26 0x0000000002de0237
clang::Sema::PerformCopyInitialization(clang::InitializedEntity const&,
clang::SourceLocation, clang::ActionResult<clang::Expr*, true>, bool, bool)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2de0237)
#27 0x0000000002d33e73
clang::Sema::GatherArgumentsForCall(clang::SourceLocation,
clang::FunctionDecl*, clang::FunctionProtoType const*, unsigned int,
llvm::ArrayRef<clang::Expr*>, llvm::SmallVectorImpl<clang::Expr*>&,
clang::Sema::VariadicCallType, bool, bool)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2d33e73)
#28 0x0000000002c7d1fd
clang::Sema::CompleteConstructorCall(clang::CXXConstructorDecl*,
llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation,
llvm::SmallVectorImpl<clang::Expr*>&, bool, bool)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2c7d1fd)
#29 0x0000000002dcf8c2 PerformConstructorInitialization(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, clang::InitializationSequence::Step
const&, bool&, bool, bool, clang::SourceLocation, clang::SourceLocation)
(/home/LLVM-4.0.0/bin/clang-4.0+0x2dcf8c2)

[...]

Stack dump:
0.      Program arguments: /home/LLVM-4.0.0/bin/clang-4.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
bug.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
-coverage-notes-file /home/me/bug.gcno -resource-dir
/home/LLVM-4.0.0/bin/../lib/clang/4.0.0 -internal-isystem
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../include/c++/4.8
-internal-isystem
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../include/c++/4.8/x86_64-suse-linux
-internal-isystem
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../include/c++/4.8/backward
-internal-isystem /usr/local/include -internal-isystem
/home/LLVM-4.0.0/bin/../lib/clang/4.0.0/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir /home/me -ferror-limit 19 -fmessage-length 0
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o
bug.o -x c++ bug.cc
1.      bug.cc:16:11: current parser token ';'
clang-4.0: error: unable to execute command: Segmentation fault
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (tags/RELEASE_400/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/LLVM-4.0.0/bin

-- 
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/20170507/1f7a883e/attachment.html>


More information about the llvm-bugs mailing list