<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - Assertion during Peephole Optimization"
   href="http://llvm.org/bugs/show_bug.cgi?id=19318">19318</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion during Peephole Optimization
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>Common Code Generator Code
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>rtrieu@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>lhames@gmail.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=12329" name="attach_12329" title="Preprocessed source">attachment 12329</a> <a href="attachment.cgi?id=12329&action=edit" title="Preprocessed source">[details]</a></span>
Preprocessed source

mapper.cpp:
include <map>
using std::map;
using std::pair;

template <class T> class Allocator {
 public:
  typedef T value_type;
  typedef unsigned size_type;
  typedef T* pointer;
  typedef const T* const_pointer;
  typedef T& reference;
  typedef const T& const_reference;

  template<class X>
  Allocator(X x) { }

  void deallocate(void* memory, size_type size) {
    if ( memory == pointer1 ) {
      pointer2 = pointer1;
    }
  }

  template<class U> struct rebind {
    typedef Allocator<U> other;
  };

  void destroy(void*) {}

  char* pointer1;
  char* pointer2;

};

class MapWrapper {
 public:
  ~MapWrapper();
  typedef map<int, int, std::less<int>, Allocator<pair<int, int> > > Map;
  Map map_;
};

MapWrapper::~MapWrapper() {}


Commandline:
clang -g -O2 mapper.cpp

Output:
clang-3.5: ../include/llvm/CodeGen/MachineOperand.h:265: unsigned int
llvm::MachineOperand::getReg() const: Assertion `isReg() && "This is not a
register operand!"' failed.
0  clang-3.5       0x0000000001803b2e llvm::sys::PrintStackTrace(_IO_FILE*) +
46
1  clang-3.5       0x0000000001803e0b
2  clang-3.5       0x000000000180552e
3  libpthread.so.0 0x00007fef83178cb0
4  libc.so.6       0x00007fef823b6425 gsignal + 53
5  libc.so.6       0x00007fef823b9b8b abort + 379
6  libc.so.6       0x00007fef823af0ee
7  libc.so.6       0x00007fef823af192
8  clang-3.5       0x0000000000917cca
9  clang-3.5       0x0000000001f0509c llvm::MachineOperand::setReg(unsigned
int) + 28
10 clang-3.5       0x0000000001f2cb20
llvm::MachineRegisterInfo::markUsesInDebugValueAsUndef(unsigned int) const +
192
11 clang-3.5       0x0000000001f75c83
12 clang-3.5       0x0000000001f0480e
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 110
13 clang-3.5       0x00000000014921bb
llvm::FPPassManager::runOnFunction(llvm::Function&) + 427
14 clang-3.5       0x00000000014924c8
llvm::FPPassManager::runOnModule(llvm::Module&) + 104
15 clang-3.5       0x0000000001492b8a
16 clang-3.5       0x000000000149277e
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 302
17 clang-3.5       0x0000000001493151
llvm::legacy::PassManager::run(llvm::Module&) + 33
18 clang-3.5       0x000000000209bb7c
19 clang-3.5       0x000000000209b4a2
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) + 114
20 clang-3.5       0x00000000020986d0
21 clang-3.5       0x0000000002b4674c clang::ParseAST(clang::Sema&, bool, bool)
+ 796
22 clang-3.5       0x00000000019f2f09 clang::ASTFrontendAction::ExecuteAction()
+ 345
23 clang-3.5       0x0000000002097b42 clang::CodeGenAction::ExecuteAction() +
1474
24 clang-3.5       0x00000000019f262f clang::FrontendAction::Execute() + 191
25 clang-3.5       0x00000000019bcc4d
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 797
26 clang-3.5       0x0000000001b217e4
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1044
27 clang-3.5       0x000000000090b5ca cc1_main(char const**, char const**, char
const*, void*) + 698
28 clang-3.5       0x0000000000902d27 main + 759
29 libc.so.6       0x00007fef823a176d __libc_start_main + 237
30 clang-3.5       0x00000000009028d5
Stack dump:
0.    Program arguments: /usr/local/clang/qual/llvm/llvm_build/bin/clang-3.5
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name
mapper.cpp -mrelocation-model static -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64
-momit-leaf-frame-pointer -g -resource-dir
/usr/local/clang/qual/llvm/llvm_build/bin/../lib/clang/3.5.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/x86_64-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/backward
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/x86_64-linux-gnu/c++/4.6
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang/qual/llvm/llvm_build/bin/../lib/clang/3.5.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O2
-fdeprecated-macro -fdebug-compilation-dir
/usr/local/clang/qual/llvm/llvm_build -ferror-limit 19 -fmessage-length 80
-mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/mapper-8a215e.o -x c++ mapper.cpp 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'mapper.cpp'.
4.    Running pass 'Peephole Optimizations' on function
'@_ZNSt8_Rb_treeIiSt4pairIKiiESt10_Select1stIS2_ESt4lessIiE9AllocatorIS2_EE8_M_eraseEPSt13_Rb_tree_nodeIS2_E'
clang-3.5: error: unable to execute command: Aborted (core dumped)
clang-3.5: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.5.0 (205487)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang-3.5: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.5: note: diagnostic msg: 
********************

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

********************</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>