[llvm-bugs] [Bug 30343] New: clang crashes on C++ code with incorrect copy constructor

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 9 20:45:40 PDT 2016


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

            Bug ID: 30343
           Summary: clang crashes on C++ code with incorrect copy
                    constructor
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

It seems to affect at least all versions 2.9 and later. 


$ clang++ -v
clang version 4.0.0 (trunk 280978)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.1.1
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ 
$ clang++ -c small.cpp
#0 0x0000000001e787e5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1e787e5)
#1 0x0000000001e768ce llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-4.0+0x1e768ce)
#2 0x0000000001e76a30 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-4.0+0x1e76a30)
#3 0x00007f68e60fa340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x000000000308f7f3
clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType,
clang::Sema::TypeDiagnoser*) (/usr/local/clang-trunk/bin/clang-4.0+0x308f7f3)
#5 0x0000000002e87a33 TryConstructorInitialization(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, clang::QualType,
clang::InitializationSequence&, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2e87a33)
#6 0x0000000002e89382
clang::InitializationSequence::InitializeFrom(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2e89382)
#7 0x0000000002e92f50
clang::Sema::PerformCopyInitialization(clang::InitializedEntity const&,
clang::SourceLocation, clang::ActionResult<clang::Expr*, true>, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2e92f50)
#8 0x0000000002de7c3e
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)
(/usr/local/clang-trunk/bin/clang-4.0+0x2de7c3e)

... 

#34 0x0000000002e92f72
clang::Sema::PerformCopyInitialization(clang::InitializedEntity const&,
clang::SourceLocation, clang::ActionResult<clang::Expr*, true>, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2e92f72)
#35 0x0000000002de7c3e
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)
(/usr/local/clang-trunk/bin/clang-4.0+0x2de7c3e)
#36 0x0000000002d2b77f
clang::Sema::CompleteConstructorCall(clang::CXXConstructorDecl*,
llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation,
llvm::SmallVectorImpl<clang::Expr*>&, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2d2b77f)
#37 0x0000000002e905ea clang::InitializationSequence::Perform(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, clang::QualType*)
(/usr/local/clang-trunk/bin/clangsica [131] % tail out
clang-4.0: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-4.0: note: diagnostic msg: /tmp/small-445b51.cpp
clang-4.0: note: diagnostic msg: /tmp/small-445b51.sh
clang-4.0: note: diagnostic msg: 

********************
$ 


---------------------------


struct A;

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

struct A
{
  A (B);
};

B f (B const &b)
{
  return b;
}

-- 
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/20160910/23da58e1/attachment-0001.html>


More information about the llvm-bugs mailing list