Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Crash creating object without defined constructor. #8037

Closed Quuxplusone closed 13 years ago

Quuxplusone commented 14 years ago
Bugzilla Link PR7597
Status RESOLVED INVALID
Importance P normal
Reported by dlarimer@gmail.com
Reported on 2010-07-08 13:19:26 -0700
Last modified on 2011-09-02 19:22:05 -0700
Version trunk
Hardware Macintosh MacOS X
CC efriedma@quicinc.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments spec_tree-sRt9vh.ii (20870 bytes, application/octet-stream)
Blocks
Blocked by
See also
I was attempting to compile code with clang that compiled fine with gcc and
VC++.  I was unable to determine the exact "cause" of the clang crash because
it could be triggered by various arrangements of the code and showed no clear
"pattern".

If I directly specify the type (instead of using the template parameter) it
works.  If I use a template parameter and then instantiate the class with the
template parameter set to the same type it crashes.

If i construct on the stack it works.  If I construct via new it crashes clang;

Given the following code
class SomeType{};

template<typename T, template <typename T> DelegateType = DefautlDelegateType >
struct stub
{
     // lots of nested struct declarations here.
}

namespace bb {
   class server
   {
       template<typename T>
       server( boost::shared_ptr<T>& ptr )
       {
            stub<SomeType>  x; // works
            new stub<SomeType>; // works
            stub<T> y; // works
             new stub<T>; // with T == SomeType crashes clang, unless stub defines a constructor
       }
   };
}

Assertion failed: ((Record->hasTrivialCopyConstructor() || Record-
>hasTrivialCopyAssignment()) && "Trying to aggregate-copy a type without a
trivial copy " "constructor or assignment operator"), function
EmitAggregateCopy, file
/Users/dlarimer/projects/llvm/tools/clang/lib/CodeGen/CGExprAgg.cpp, line 792.
Stack dump:
0.  Program arguments: /usr/local/bin/clang -cc1 -triple x86_64-apple-
darwin10.0.0 -emit-obj -mrelax-all -disable-free -main-file-name serv.cpp -pic-
level 1 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -
resource-dir /usr/local/lib/clang/2.8 -D QT_NO_DEBUG_OUTPUT -D
__STDC_LIMIT_MACROS -I /Users/dlarimer/projects/fl/libraries -I
/Users/dlarimer/projects/fl/libraries/core -I
/Users/dlarimer/projects/fl/libraries/drivers -I /usr/local/include -ferror-
limit 19 -fmessage-length 270 -stack-protector 1 -fblocks -fexceptions -
fdiagnostics-show-option -fcolor-diagnostics -o CMakeFiles/bbs.dir/serv.cpp.o -
x c++ /Users/dlarimer/projects/fl/libraries/fl/backbone/serv.cpp -v
1.  <eof> parser at end of file
2.  Per-file LLVM IR generation
3.  /Users/dlarimer/projects/fl/libraries/fl/backbone/server.hpp:20:5:
Generating code for declaration 'bb::server::server'
4.  /Users/dlarimer/projects/fl/libraries/fl/backbone/server.hpp:22:5: LLVM IR
generation of compound statement ('{}')
Quuxplusone commented 14 years ago

Can you attach a complete testcase that crashes?

Quuxplusone commented 13 years ago

Attached spec_tree-sRt9vh.ii (20870 bytes, application/octet-stream): delta-reduced input (not valid code but manages to make clang++ crash)

Quuxplusone commented 13 years ago

Elias, the problem you're reporting is very unlikely to be the same issue; please file a new bug (and mention rvalue references in the title).

Closing this bug due to lack of response from the original reporter.