<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::SelectionDAGBuilder::visitBinary(llvm::User const&, unsigned int)"
   href="http://llvm.org/bugs/show_bug.cgi?id=19334">19334</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Segmentation fault in llvm::SelectionDAGBuilder::visitBinary(llvm::User const&, unsigned int)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.4
          </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>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@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>clang 3.4 segfaults when compiling the following reduced testcase on x86_64:

int fc3 = 0;

static int
xth(int bfy, int nqq)
{
  return bfy + nqq;
}

static int
qd8(short int y80)
{
  static int w41[1][1];
  static int v06;
  int p7c, ed9, o7f;
  int *j3e = &w41[0][0];
  for (p7c = 0; p7c < 6; ++p7c)
    for (ed9 = 0; ed9 < 6; ++ed9)
      for (o7f = 0; o7f < 6; ++o7f)
        y80 = xth((&v06 != j3e) & y80, y80);
  return y80;
}

void
ade(void)
{
  int *g4e = &fc3;
  *g4e ^= qd8(1);
}

% clang -c -O2 -o 42210194.o 42210194.c
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
clang: 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: 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: /tmp/42210194-fdd77a.c
clang: note: diagnostic msg: /tmp/42210194-fdd77a.sh
clang: note: diagnostic msg: 

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

Top 6 frames from stack trace:
#0  0x00007f9b76fb870c in llvm::SelectionDAGBuilder::visitBinary(llvm::User
const&, unsigned int) ()
   from /usr/bin/../lib/libLLVM-3.4.so
#1  0x00007f9b76fb409f in llvm::SelectionDAGBuilder::getValueImpl(llvm::Value
const*) () from /usr/bin/../lib/libLLVM-3.4.so
#2  0x00007f9b76fb4d15 in llvm::SelectionDAGBuilder::getValue(llvm::Value
const*) () from /usr/bin/../lib/libLLVM-3.4.so
#3  0x00007f9b76fb8711 in llvm::SelectionDAGBuilder::visitBinary(llvm::User
const&, unsigned int) ()
   from /usr/bin/../lib/libLLVM-3.4.so
#4  0x00007f9b76fb409f in llvm::SelectionDAGBuilder::getValueImpl(llvm::Value
const*) () from /usr/bin/../lib/libLLVM-3.4.so
#5  0x00007f9b76fb4d15 in llvm::SelectionDAGBuilder::getValue(llvm::Value
const*) () from /usr/bin/../lib/libLLVM-3.4.so
#6  0x00007f9b76fb8711 in llvm::SelectionDAGBuilder::visitBinary(llvm::User
const&, unsigned int) ()

The following 20913 frames are completely identical. And at the beginning there
is:
#20920 0x00007f9b76fb409f in
llvm::SelectionDAGBuilder::getValueImpl(llvm::Value const*) () from
/usr/bin/../lib/libLLVM-3.4.so
#20921 0x00007f9b76fb4d15 in llvm::SelectionDAGBuilder::getValue(llvm::Value
const*) () from /usr/bin/../lib/libLLVM-3.4.so
#20922 0x00007f9b76fb9900 in llvm::SelectionDAGBuilder::visitSExt(llvm::User
const&) () from /usr/bin/../lib/libLLVM-3.4.so
#20923 0x00007f9b76fb409f in
llvm::SelectionDAGBuilder::getValueImpl(llvm::Value const*) () from
/usr/bin/../lib/libLLVM-3.4.so
#20924 0x00007f9b76fb4d15 in llvm::SelectionDAGBuilder::getValue(llvm::Value
const*) () from /usr/bin/../lib/libLLVM-3.4.so
#20925 0x00007f9b76fb8727 in llvm::SelectionDAGBuilder::visitBinary(llvm::User
const&, unsigned int) ()
   from /usr/bin/../lib/libLLVM-3.4.so
#20926 0x00007f9b76fd4c14 in llvm::SelectionDAGBuilder::visit(llvm::Instruction
const&) () from /usr/bin/../lib/libLLVM-3.4.so
#20927 0x00007f9b76fe5ed1 in
llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::Instruction
const>, llvm::ilist_iterator<llvm::Instruction const>, bool&) () from
/usr/bin/../lib/libLLVM-3.4.so
#20928 0x00007f9b76fe7659 in
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) () from
/usr/bin/../lib/libLLVM-3.4.so
#20929 0x00007f9b76fe88a1 in
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) ()
   from /usr/bin/../lib/libLLVM-3.4.so
#20930 0x00007f9b76669da9 in
llvm::FPPassManager::runOnFunction(llvm::Function&) () from
/usr/bin/../lib/libLLVM-3.4.so
#20931 0x00007f9b76669e3b in llvm::FPPassManager::runOnModule(llvm::Module&) ()
from /usr/bin/../lib/libLLVM-3.4.so
#20932 0x00007f9b7666c2e9 in llvm::legacy::PassManagerImpl::run(llvm::Module&)
() from /usr/bin/../lib/libLLVM-3.4.so
#20933 0x00000000007de14e in
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) ()
#20934 0x00000000007db801 in ?? ()
#20935 0x0000000000962e33 in clang::ParseAST(clang::Sema&, bool, bool) ()
#20936 0x000000000066b789 in clang::FrontendAction::Execute() ()
#20937 0x0000000000649534 in
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) ()
#20938 0x0000000000631316 in
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) ()
#20939 0x000000000062cf38 in cc1_main(char const**, char const**, char const*,
void*) ()
#20940 0x000000000062b5a5 in main ()

When building w/ -emit-llvm, clang hangs indefinitely instead. Interesting perf
top output is:
 18.64%  libLLVM-3.4.so [.]
_ZN4llvm15ValueEnumerator20EnumerateOperandTypeEPKNS_5ValueE
 12.07%  libLLVM-3.4.so [.] _ZN4llvm15ValueEnumerator13EnumerateTypeEPNS_4TypeE
It seems to loop in llvm::ValueEnumerator::EnumerateOperandType(llvm::Value
const*).</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>