<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Crash in infinite loop trying to find a proper constructor"
   href="https://bugs.llvm.org/show_bug.cgi?id=32955">32955</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash in infinite loop trying to find a proper constructor
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>4.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>v.reichelt@netcologne.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>