[LLVMbugs] [Bug 21434] New: Crash with "The unwind destination does not have a landingpad instruction!" if move assignment operator is missing (no warning or error issued.)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Oct 31 11:41:54 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=21434

            Bug ID: 21434
           Summary: Crash with "The unwind destination does not have a
                    landingpad instruction!" if move assignment operator
                    is missing (no warning or error issued.)
           Product: clang
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hannes_weisbach at gmx.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

As far as I can understand this, I'm creating a type missing a move assignment
operator. When calling std::stable_sort on a std::vector of said type, clang++
crashes, issuing no warning or error pertaining to the missing move assignment
operator.

I created a minimal example crashing clang (and successfully compiling when
adding a move assignment operator). The preprocessed source is attached. The
run script is pasted below the compiler output (I can only attach one file?!).

So obviously my code crashing clang++ is broken, but in my opinion it should
not crash. Maybe I'm missing something, though.

The compiler call and output is as follows:

$ clang++-mp-3.6 -v -std=c++11 -O3 -I . ./testcase.c++ -Weverything
clang version 3.6.0 (trunk 216817)
Target: x86_64-apple-darwin13.3.0
Thread model: posix
 "/opt/local/libexec/llvm-3.6/bin/clang" -cc1 -triple x86_64-apple-macosx10.9.0
-emit-obj -disable-free -main-file-name testcase.c++ -mrelocation-model pic
-pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2
-target-linker-version 236.3 -v -dwarf-column-info -resource-dir
/opt/local/libexec/llvm-3.6/bin/../lib/clang/3.6.0 -I . -stdlib=libc++ -O3
-Weverything -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /tmp
-ferror-limit 19 -fmessage-length 166 -stack-protector 1 -mstackrealign
-fblocks -fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature
-fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o
/var/folders/by/5csj6l1j6hlchlpftmzrf9l80000gn/T/testcase-7c6ca1.o -x c++
./testcase.c++
clang -cc1 version 3.6.0 based upon LLVM 3.6.0svn default target
x86_64-apple-darwin13.3.0
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
 .
 /opt/local/libexec/llvm-3.6/bin/../include/c++/v1
 /usr/local/include
 /opt/local/libexec/llvm-3.6/bin/../lib/clang/3.6.0/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
./testcase.c++:7:56: warning: defaulted function definitions are incompatible
with C++98 [-Wc++98-compat]
  broken_vector &operator=(const broken_vector &rhs) = default;
                                                       ^
./testcase.c++:7:18: warning: definition of implicit copy constructor for
'broken_vector<non_primitive_type>' is deprecated because it has a
user-declared copy
      assignment operator [-Wdeprecated]
  broken_vector &operator=(const broken_vector &rhs) = default;
                 ^
/opt/local/libexec/llvm-3.6/bin/../include/c++/v1/memory:1572:18: note: in
instantiation of function template specialization
      'std::__1::allocator<user_type>::construct<user_type, user_type>'
requested here
            {__a.construct(__p, _VSTD::forward<_Args>(__args)...);}
                 ^
/opt/local/libexec/llvm-3.6/bin/../include/c++/v1/memory:1453:14: note: in
instantiation of function template specialization
      'std::__1::allocator_traits<std::__1::allocator<user_type>
>::__construct<user_type, user_type>' requested here
            {__construct(__has_construct<allocator_type, pointer, _Args...>(),
             ^
/opt/local/libexec/llvm-3.6/bin/../include/c++/v1/vector:1600:25: note: in
instantiation of function template specialization
      'std::__1::allocator_traits<std::__1::allocator<user_type>
>::construct<user_type, user_type>' requested here
        __alloc_traits::construct(this->__alloc(),
                        ^
./testcase.c++:32:9: note: in instantiation of member function
'std::__1::vector<user_type, std::__1::allocator<user_type> >::push_back'
requested here
  codes.push_back(user_type());
        ^
./testcase.c++:21:7: note: implicit copy constructor for
'broken_vector<non_primitive_type>' first required here
class user_type {
      ^
The unwind destination does not have a landingpad instruction!
  invoke void
@_ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv(%"class.std::__1::__vector_base_common"*
%3)
          to label %if.end.i.i.i.i.i.i109 unwind label %lpad.i.i.i.i.i125
The unwind destination does not have a landingpad instruction!
  %call.i.i.i.i13.i.i.i.i.i108 = invoke noalias i8* @_Znwm(i64
%sub.ptr.sub.i.i.i.i.i.i103) #5
          to label %invoke.cont.i.i.i.i.i116 unwind label %lpad.i.i.i.i.i125
LandingPadInst not the first non-PHI instruction in the block.
  %8 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)*
@__gxx_personality_v0 to i8*)
          cleanup
LandingPadInst not the first non-PHI instruction in the block.
  %12 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)*
@__gxx_personality_v0 to i8*)
          cleanup
The unwind destination does not have a landingpad instruction!
  %call26 = invoke %class.user_type*
@_ZNSt3__17__mergeIRNS_6__lessI9user_typeS2_EENS_13move_iteratorIPS2_EENS5_INS_11__wrap_iterIS6_EEEES9_EET2_T0_SC_T1_SD_SB_T_(%class.user_type*
%__buff, %class.user_type* %__p.0.lcssa, %class.user_type* %__middle.coerce,
%class.user_type* %__last.coerce, %class.user_type* %__first.coerce,
%"struct.std::__1::__less"* dereferenceable(1) %__comp)
          to label %if.end unwind label %lpad
The unwind destination does not have a landingpad instruction!
  invoke void
@_ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv(%"class.std::__1::__vector_base_common"*
%22)
          to label %if.end.i.i.i.i.i.i unwind label %lpad.i.i.i.i.i
The unwind destination does not have a landingpad instruction!
  %call.i.i.i.i13.i.i.i.i.i = invoke noalias i8* @_Znwm(i64
%sub.ptr.sub.i.i.i.i.i.i) #5
          to label %invoke.cont.i.i.i.i.i unwind label %lpad.i.i.i.i.i
LandingPadInst not the first non-PHI instruction in the block.
  %27 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)*
@__gxx_personality_v0 to i8*)
          cleanup
The unwind destination does not have a landingpad instruction!
  %call71 = invoke { %class.user_type*, %class.user_type* }
@_ZNSt3__17__mergeINS_8__negateIRNS_6__lessI9user_typeS3_EEEENS_13move_iteratorINS_16reverse_iteratorINS_11__wrap_iterIPS3_EEEEEENS7_INS8_ISA_EEEESC_EET2_T0_SH_T1_SI_SG_T_(%class.user_type*
%__middle.coerce, %class.user_type* %__middle.coerce, %class.user_type*
%__first.coerce, %class.user_type* %__first.coerce, %class.user_type*
%__p28.0.lcssa, %class.user_type* %__p28.0.lcssa,
%"class.std::__1::move_iterator.13"* byval align 8 %agg.tmp59,
%"class.std::__1::reverse_iterator"* byval align 8 %agg.tmp63, i64
%coerce.val.pi)
          to label %if.end unwind label %lpad
fatal error: error in backend: Broken function found, compilation aborted!
clang: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 3.6.0 (trunk 216817)
Target: x86_64-apple-darwin13.3.0
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ 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/by/5csj6l1j6hlchlpftmzrf9l80000gn/T/testcase-c81b09.cpp
clang: note: diagnostic msg:
/var/folders/by/5csj6l1j6hlchlpftmzrf9l80000gn/T/testcase-c81b09.sh
clang: note: diagnostic msg:

********************

The run script contains:

 "/opt/local/libexec/llvm-3.6/bin/clang" -cc1 -triple x86_64-apple-macosx10.9.0
-emit-obj -disable-free -main-file-name testcase.c++ -mrelocation-model pic
-pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2
-target-linker-version 236.3 -v -dwarf-column-info -stdlib=libc++ -O3
-Weverything -std=c++11 -fdeprecated-macro -ferror-limit 19 -fmessage-length
166 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0
-fencode-extended-block-signature -fcxx-exceptions -fexceptions
-fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-loops -vectorize-slp -x c++ testcase-c81b09.cpp

(end-of-runscript)

I hope this helps.

-- 
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/20141031/b2e2caaf/attachment.html>


More information about the llvm-bugs mailing list