<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Stack overflow during Thin-LTO link"
   href="https://bugs.llvm.org/show_bug.cgi?id=49949">49949</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Stack overflow during Thin-LTO link
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>release blocker
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>llvm@martijnotto.nl
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, smithp352@googlemail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Linking a large application built as RelWithDebInfo and ThinLTO enabled leads
to a stack overflow in the 12.0 RCs. This is a regression from 11.0, which
works.

It eventually fails in ValueTracking.cpp, in the computeKnownBitsFromAssume
function, while calling Known.getBitWidth(). I can print Known from lldb just
fine, but calling the getBitWidth member function fails with an "address access
protected" error. The stack trace at this point shows 13026 entries, which
looks like a stack overflow.

The 25 top-most stack frames:

* thread #15, name = 'ld.lld', stop reason = signal SIGSEGV: address access
protected (fault address: 0x7fff6a9f4fe8)
  * frame #0: 0x000000000510da71
ld.lld`computeKnownBitsFromAssume(V=0x00007ffe4f728c20,
Known=0x00007fff6a9f7760, Depth=5, Q=0x00007fff6a9f7148)::Query const&) at
ValueTracking.cpp:662:29
    frame #1: 0x00000000050f9cf6 ld.lld`computeKnownBits(V=0x00007ffe4f728c20,
DemandedElts=0x00007fff6a9f6be0, Known=0x00007fff6a9f7760, Depth=5,
Q=0x00007fff6a9f7148)::Query const&) at ValueTracking.cpp:1898:3
    frame #2: 0x00000000050f921e ld.lld`computeKnownBits(V=0x00007ffe4f728c20,
Known=0x00007fff6a9f7760, Depth=5, Q=0x00007fff6a9f7148)::Query const&) at
ValueTracking.cpp:217:3
    frame #3: 0x000000000510c6a9
ld.lld`computeKnownBitsFromOperator(I=0x00007ffe4f728b38,
DemandedElts=0x00007fff6a9f79a0, Known=0x00007fff6a9f87d8, Depth=2,
Q=0x00007fff6a9f8c10)::Query const&) at
deb <a href="http://apt.llvm.org/focal/">http://apt.llvm.org/focal/</a> llvm-toolchain-focal-11 main
 ValueTracking.cpp:1479:9
    frame #4: 0x00000000050f9c72 ld.lld`computeKnownBits(V=0x00007ffe4f728b38,
DemandedElts=0x00007fff6a9f79a0, Known=0x00007fff6a9f87d8, Depth=2,
Q=0x00007fff6a9f8c10)::Query const&) at ValueTracking.cpp:1886:5
    frame #5: 0x00000000050f921e ld.lld`computeKnownBits(V=0x00007ffe4f728b38,
Known=0x00007fff6a9f87d8, Depth=2, Q=0x00007fff6a9f8c10)::Query const&) at
ValueTracking.cpp:217:3
    frame #6: 0x000000000510bab2
ld.lld`computeKnownBitsFromOperator(I=0x00007ffe4f728c20,
DemandedElts=0x00007fff6a9f8ad0, Known=0x00007fff6a9f87d8, Depth=1,
Q=0x00007fff6a9f8c10)::Query const&) at ValueTracking.cpp:1279:5
    frame #7: 0x00000000050f9c72 ld.lld`computeKnownBits(V=0x00007ffe4f728c20,
DemandedElts=0x00007fff6a9f8ad0, Known=0x00007fff6a9f87d8, Depth=1,
Q=0x00007fff6a9f8c10)::Query const&) at ValueTracking.cpp:1886:5
    frame #8: 0x0000000005109ef1
ld.lld`ComputeNumSignBitsImpl(V=0x00007ffe4f728c20,
DemandedElts=0x00007fff6a9f8ad0, Depth=1, Q=0x00007fff6a9f8c10)::Query const&)
at ValueTracking.cpp:2978:3
    frame #9: 0x0000000005108e7b
ld.lld`ComputeNumSignBits(V=0x00007ffe4f728c20,
DemandedElts=0x00007fff6a9f8ad0, Depth=1, Q=0x00007fff6a9f8c10)::Query const&)
at ValueTracking.cpp:2652:21
    frame #10: 0x00000000050fbdb4
ld.lld`ComputeNumSignBits(V=0x00007ffe4f728c20, Depth=1,
Q=0x00007fff6a9f8c10)::Query const&) at ValueTracking.cpp:389:10
    frame #11: 0x0000000005109bb1
ld.lld`ComputeNumSignBitsImpl(V=0x00007ffe4f728b38,
DemandedElts=0x00007fff6a9f8e90, Depth=0, Q=0x00007fff6a9f8f08)::Query const&)
at ValueTracking.cpp:2901:18
    frame #12: 0x0000000005108e7b
ld.lld`ComputeNumSignBits(V=0x00007ffe4f728b38,
DemandedElts=0x00007fff6a9f8e90, Depth=0, Q=0x00007fff6a9f8f08)::Query const&)
at ValueTracking.cpp:2652:21
    frame #13: 0x00000000050fbdb4
ld.lld`ComputeNumSignBits(V=0x00007ffe4f728b38, Depth=0,
Q=0x00007fff6a9f8f08)::Query const&) at ValueTracking.cpp:389:10
    frame #14: 0x00000000050fbcff
ld.lld`llvm::ComputeNumSignBits(V=0x00007ffe4f728b38, DL=0x00007fff49aafad0,
Depth=0, AC=0x00007ffe4dc03958, CxtI=0x0000000000000000, DT=0x00007ffe4d49e948,
UseInstrInfo=true) at ValueTracking.cpp:396:10
    frame #15: 0x0000000005020edc
ld.lld`llvm::ScalarEvolution::getRangeRef(this=0x00007fff49bc9d48,
S=0x00007ffe531cbcb0, SignHint=HINT_RANGE_SIGNED) at
ScalarEvolution.cpp:5854:21
    frame #16: 0x0000000003e2ed61
ld.lld`llvm::ScalarEvolution::getSignedRange(this=0x00007fff49bc9d48,
S=0x00007ffe531cbcb0) at ScalarEvolution.h:868:12
    frame #17: 0x0000000005014e4f
ld.lld`StrengthenNoWrapFlags(SE=0x00007fff49bc9d48, Type=scAddExpr, Ops=const
llvm::ArrayRef<const llvm::SCEV *> @ 0x00007fff6a9f9e60, Flags=FlagNUW) at
ScalarEvolution.cpp:2262:34
    frame #18: 0x0000000005013631
ld.lld`llvm::ScalarEvolution::getAddExpr(this=0x00007fff6a9fa7d8, Ops=const
llvm::ArrayRef<const llvm::SCEV *> @
0x00007fff6a9f9ea0)::$_0::operator()(llvm::ArrayRef<llvm::SCEV const*>) const
at ScalarEvolution.cpp:2324:12
    frame #19: 0x000000000500b015
ld.lld`llvm::ScalarEvolution::getAddExpr(this=0x00007fff49bc9d48,
Ops=0x00007fff6a9fa890, OrigFlags=FlagNUW, Depth=0) at
ScalarEvolution.cpp:2674:34
    frame #20: 0x00000000020c3747
ld.lld`llvm::ScalarEvolution::getAddExpr(this=0x00007fff49bc9d48,
LHS=0x00007ffe531cbcb0, RHS=0x00007ffe4d158920, Flags=FlagNUW, Depth=0) at
ScalarEvolution.h:527:12
    frame #21: 0x00000000050153c7
ld.lld`llvm::ScalarEvolution::getGEPExpr(this=0x00007fff49bc9d48,
GEP=0x00007ffe4f728c20, IndexExprs=0x00007fff6a9faa08) at
ScalarEvolution.cpp:3469:10
    frame #22: 0x000000000501ebcd
ld.lld`llvm::ScalarEvolution::createNodeForGEP(this=0x00007fff49bc9d48,
GEP=0x00007ffe4f728c20) at ScalarEvolution.cpp:5521:10
    frame #23: 0x0000000005019642
ld.lld`llvm::ScalarEvolution::createSCEV(this=0x00007fff49bc9d48,
V=0x00007ffe4f728c20) at ScalarEvolution.cpp:6733:12
    frame #24: 0x00000000050154b1
ld.lld`llvm::ScalarEvolution::getSCEV(this=0x00007fff49bc9d48,
V=0x00007ffe4f728c20) at ScalarEvolution.cpp:3873:9

This was build from fa0971b87</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>