<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 --- - Segmentation fault in llvm::InstrEmitter::getVR"
   href="http://llvm.org/bugs/show_bug.cgi?id=19555">19555</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Segmentation fault in llvm::InstrEmitter::getVR
          </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>asolokha@gmx.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>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=12442" name="attach_12442" title="Reduced bitcode">attachment 12442</a> <a href="attachment.cgi?id=12442&action=edit" title="Reduced bitcode">[details]</a></span>
Reduced bitcode

LLVM 3.4 crashes when compiling the following reduced testcase w/ clang at
optimization level -O1 and above:

void
k(void)
{
  static int n;
  static int h;
  volatile int p;
  ++n;
  n = p * (!(++h));
}

% clang -c -O1 8a5da732.c              
0  libLLVM-3.4.so  0x00007f2bd97eb962 llvm::sys::PrintStackTrace(_IO_FILE*) +
34
1  libLLVM-3.4.so  0x00007f2bd97eb73c
2  libpthread.so.0 0x00007f2bd87f51b0
3  libLLVM-3.4.so  0x00007f2bd9863d34 llvm::InstrEmitter::getVR(llvm::SDValue,
llvm::DenseMap<llvm::SDValue, unsigned int, llvm::DenseMapInfo<llvm::SDValue>
<span class="quote">>&) + 148</span >
4  libLLVM-3.4.so  0x00007f2bd9863ec6
llvm::InstrEmitter::AddRegisterOperand(llvm::MachineInstrBuilder&,
llvm::SDValue, unsigned int, llvm::MCInstrDesc const*,
llvm::DenseMap<llvm::SDValue, unsigned int, llvm::DenseMapInfo<llvm::SDValue>
<span class="quote">>&, bool, bool, bool) + 86</span >
5  libLLVM-3.4.so  0x00007f2bd9864e8b
llvm::InstrEmitter::AddOperand(llvm::MachineInstrBuilder&, llvm::SDValue,
unsigned int, llvm::MCInstrDesc const*, llvm::DenseMap<llvm::SDValue, unsigned
int, llvm::DenseMapInfo<llvm::SDValue> >&, bool, bool, bool) + 475
6  libLLVM-3.4.so  0x00007f2bd98684f3
llvm::InstrEmitter::EmitMachineNode(llvm::SDNode*, bool, bool,
llvm::DenseMap<llvm::SDValue, unsigned int, llvm::DenseMapInfo<llvm::SDValue>
<span class="quote">>&) + 515</span >
7  libLLVM-3.4.so  0x00007f2bd98f49d1
llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineBasicBlock::bundle_iterator<llvm::MachineInstr,
llvm::ilist_iterator<llvm::MachineInstr> >&) + 737
8  libLLVM-3.4.so  0x00007f2bd9959c9b
llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 635
9  libLLVM-3.4.so  0x00007f2bd995b659
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 1065
10 libLLVM-3.4.so  0x00007f2bd995c8a1
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 993
11 libLLVM-3.4.so  0x00007f2bd8fddda9
llvm::FPPassManager::runOnFunction(llvm::Function&) + 473
12 libLLVM-3.4.so  0x00007f2bd8fdde3b
llvm::FPPassManager::runOnModule(llvm::Module&) + 43
13 libLLVM-3.4.so  0x00007f2bd8fe02e9
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 697
14 clang           0x00000000007de14e
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 2862
15 clang           0x00000000007db801
16 clang           0x0000000000962e33 clang::ParseAST(clang::Sema&, bool, bool)
+ 563
17 clang           0x000000000066b789 clang::FrontendAction::Execute() + 153
18 clang           0x0000000000649534
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1076
19 clang           0x0000000000631316
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1622
20 clang           0x000000000062cf38 cc1_main(char const**, char const**, char
const*, void*) + 1128
21 clang           0x000000000062b5a5 main + 7621
22 libc.so.6       0x00007f2bd8463a65 __libc_start_main + 245
23 clang           0x000000000062be0f
Stack dump:
0.    Program arguments: /usr/bin/clang -cc1 -triple x86_64-pc-linux-gnu
-emit-obj -disable-free -disable-llvm-verifier -main-file-name 8a5da732.c
-mrelocation-model static -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.24
-momit-leaf-frame-pointer -coverage-file /home/asolokha/8a5da732.o
-resource-dir /usr/bin/../lib/clang/3.4 -internal-isystem /usr/local/include
-internal-isystem /usr/bin/../lib/clang/3.4/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -O1 -fdebug-compilation-dir
/home/asolokha -ferror-limit 19 -fmessage-length 136 -mstackrealign
-fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-slp -o 8a5da732.o -x c
8a5da732.c 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module '8a5da732.c'.
4.    Running pass 'X86 DAG->DAG Instruction Selection' on function '@k'
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-pc-linux-gnu
Thread model: posix</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>