<html>
    <head>
      <base href="https://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 --- - opt -gvn crash"
   href="https://llvm.org/bugs/show_bug.cgi?id=23096">23096</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>opt -gvn crash
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>bruce.mitchener@gmail.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=14130" name="attach_14130" title="Minimized test case to reproduce crash">attachment 14130</a> <a href="attachment.cgi?id=14130&action=edit" title="Minimized test case to reproduce crash">[details]</a></span>
Minimized test case to reproduce crash

When running "opt -gvn" against the attached IR, it crashes with infinite
recursion:

    frame #9000: 0x0000000100513963
opt`llvm::PHITransAddr::PHITranslateSubExpr(this=0x00007fff5fbfa7d0,
V=0x0000000103405b80, CurBB=0x00000001034044e0, PredBB=0x00000001034044e0,
DT=0x0000000000000000) + 1827 at PHITransAddr.cpp:220
    frame #9001: 0x0000000100513963
opt`llvm::PHITransAddr::PHITranslateSubExpr(this=0x00007fff5fbfa7d0,
V=0x0000000103405b80, CurBB=0x00000001034044e0, PredBB=0x00000001034044e0,
DT=0x0000000000000000) + 1827 at PHITransAddr.cpp:220
    frame #9002: 0x0000000100513963
opt`llvm::PHITransAddr::PHITranslateSubExpr(this=0x00007fff5fbfa7d0,
V=0x0000000103405b80, CurBB=0x00000001034044e0, PredBB=0x00000001034044e0,
DT=0x0000000000000000) + 1827 at PHITransAddr.cpp:220
    frame #9003: 0x0000000100513963
opt`llvm::PHITransAddr::PHITranslateSubExpr(this=0x00007fff5fbfa7d0,
V=0x0000000103405b80, CurBB=0x00000001034044e0, PredBB=0x00000001034044e0,
DT=0x0000000000000000) + 1827 at PHITransAddr.cpp:220
    frame #9004: 0x0000000100513963
opt`llvm::PHITransAddr::PHITranslateSubExpr(this=0x00007fff5fbfa7d0,
V=0x0000000103405b80, CurBB=0x00000001034044e0, PredBB=0x00000001034044e0,
DT=0x0000000000000000) + 1827 at PHITransAddr.cpp:220
    frame #9005: 0x0000000100513963
opt`llvm::PHITransAddr::PHITranslateSubExpr(this=0x00007fff5fbfa7d0,
V=0x0000000103405b80, CurBB=0x00000001034044e0, PredBB=0x00000001034044e0,
DT=0x0000000000000000) + 1827 at PHITransAddr.cpp:220
    frame #9006: 0x0000000100513963
opt`llvm::PHITransAddr::PHITranslateSubExpr(this=0x00007fff5fbfa7d0,
V=0x0000000103405b80, CurBB=0x00000001034044e0, PredBB=0x00000001034044e0,
DT=0x0000000000000000) + 1827 at PHITransAddr.cpp:220
    frame #9007: 0x0000000100513963
opt`llvm::PHITransAddr::PHITranslateSubExpr(this=0x00007fff5fbfa7d0,
V=0x0000000103405b80, CurBB=0x00000001034044e0, PredBB=0x00000001034044e0,
DT=0x0000000000000000) + 1827 at PHITransAddr.cpp:220
    frame #9008: 0x0000000100513963
opt`llvm::PHITransAddr::PHITranslateSubExpr(this=0x00007fff5fbfa7d0,
V=0x0000000103405b80, CurBB=0x00000001034044e0, PredBB=0x00000001034044e0,
DT=0x0000000000000000) + 1827 at PHITransAddr.cpp:220
    frame #9009: 0x0000000100513963
opt`llvm::PHITransAddr::PHITranslateSubExpr(this=0x00007fff5fbfa7d0,
V=0x0000000103405b80, CurBB=0x00000001034044e0, PredBB=0x00000001034044e0,
DT=0x0000000000000000) + 1827 at PHITransAddr.cpp:220
    frame #9010: 0x0000000100513963
opt`llvm::PHITransAddr::PHITranslateSubExpr(this=0x00007fff5fbfa7d0,
V=0x0000000103405b80, CurBB=0x00000001034044e0, PredBB=0x00000001034044e0,
DT=0x0000000000000000) + 1827 at PHITransAddr.cpp:220
    frame #9011: 0x000000010051468e
opt`llvm::PHITransAddr::PHITranslateValue(this=0x00007fff5fbfa7d0,
CurBB=0x00000001034044e0, PredBB=0x00000001034044e0, DT=0x0000000000000000) +
158 at PHITransAddr.cpp:322
    frame #9012: 0x00000001004fcce4
opt`llvm::MemoryDependenceAnalysis::getNonLocalPointerDepFromBB(this=0x0000000103401f10,
Pointer=0x00007fff5fbfc030, Loc=0x00007fff5fbfb198, isLoad=true,
StartBB=0x00000001034044e0, Result=0x00007fff5fbfd100,
Visited=0x00007fff5fbfc778, SkipFirstBlock=false) + 7620 at
MemoryDependenceAnalysis.cpp:1240
    frame #9013: 0x00000001004fd00f
opt`llvm::MemoryDependenceAnalysis::getNonLocalPointerDepFromBB(this=0x0000000103401f10,
Pointer=0x00007fff5fbfc7b8, Loc=0x00007fff5fbfc890, isLoad=true,
StartBB=0x00000001034047b0, Result=0x00007fff5fbfd100,
Visited=0x00007fff5fbfc778, SkipFirstBlock=false) + 8431 at
MemoryDependenceAnalysis.cpp:1301
    frame #9014: 0x00000001004fae3f
opt`llvm::MemoryDependenceAnalysis::getNonLocalPointerDependency(this=0x0000000103401f10,
Loc=0x00007fff5fbfc890, isLoad=true, FromBB=0x00000001034047b0,
Result=0x00007fff5fbfd100) + 367 at MemoryDependenceAnalysis.cpp:876
    frame #9015: 0x0000000100f77230 opt`(anonymous
namespace)::GVN::processNonLocalLoad(this=0x0000000103402dc0,
LI=0x0000000103406258) + 192 at GVN.cpp:1711
    frame #9016: 0x0000000100f73cb8 opt`(anonymous
namespace)::GVN::processLoad(this=0x0000000103402dc0, L=0x0000000103406258) +
1432 at GVN.cpp:1905
    frame #9017: 0x0000000100f72f3f opt`(anonymous
namespace)::GVN::processInstruction(this=0x0000000103402dc0,
I=0x0000000103406258) + 367 at GVN.cpp:2227
    frame #9018: 0x0000000100f72b8b opt`(anonymous
namespace)::GVN::processBlock(this=0x0000000103402dc0, BB=0x00000001034047b0) +
251 at GVN.cpp:2402
    frame #9019: 0x0000000100f6cc51 opt`(anonymous
namespace)::GVN::iterateOnFunction(this=0x0000000103402dc0,
F=0x0000000103404050) + 1361 at GVN.cpp:2657
    frame #9020: 0x0000000100f6c5c2 opt`(anonymous
namespace)::GVN::runOnFunction(this=0x0000000103402dc0, F=0x0000000103404050) +
626 at GVN.cpp:2360
    frame #9021: 0x0000000100b5429b
opt`llvm::FPPassManager::runOnFunction(this=0x0000000103408a30,
F=0x0000000103404050) + 427 at LegacyPassManager.cpp:1541
    frame #9022: 0x0000000100b545a8
opt`llvm::FPPassManager::runOnModule(this=0x0000000103408a30,
M=0x0000000103401410) + 104 at LegacyPassManager.cpp:1561
    frame #9023: 0x0000000100b54fb4 opt`(anonymous
namespace)::MPPassManager::runOnModule(this=0x00000001034041f0,
M=0x0000000103401410) + 1412 at LegacyPassManager.cpp:1619
    frame #9024: 0x0000000100b5485e
opt`llvm::legacy::PassManagerImpl::run(this=0x0000000103401770,
M=0x0000000103401410) + 302 at LegacyPassManager.cpp:1726
    frame #9025: 0x0000000100b55731
opt`llvm::legacy::PassManager::run(this=0x00007fff5fbfeca0,
M=0x0000000103401410) + 33 at LegacyPassManager.cpp:1763
    frame #9026: 0x000000010003a946 opt`main(argc=3, argv=0x00007fff5fbff9b8) +
12630 at opt.cpp:716
    frame #9027: 0x00007fff87ac35c9 libdyld.dylib`start + 1
    frame #9028: 0x00007fff87ac35c9 libdyld.dylib`start + 1

This happens with: LLVM 3.6.0 release, trunk as of earlier this week and the
emscripten-fastcomp branch. (That means it probably also happens with current
PNaCl.)

The crash in our codebase happens in the implementation of wcsstr() which comes
from the MUSL libc as used by emscripten.  I will attach the IR for that
function in case it helps to see that in addition to the minimized test case.</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>