<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 - ppc_fp128 math causes: Assertion failed: (!carry), function addOrSubtractSignificand"
   href="https://bugs.llvm.org/show_bug.cgi?id=45430">45430</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ppc_fp128 math causes: Assertion failed: (!carry), function addOrSubtractSignificand
          </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>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Core LLVM classes
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>florian_hahn@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The code below causes LLVM to crash when running opt -instcombine with the
trace below

define ppc_fp128 @bitcast_bitcast_s_s_s() {
  %B2 = fadd ppc_fp128 0xM00000000000000010000000000000000,
0xM00000000000000010000000000000000
  %B16 = fmul ppc_fp128 %B2, 0xM7FEFFFFFFFFFFFFF7C8FFFFFFFFFFFFE
  %B10 = fadd ppc_fp128 %B2, 0xM00000000000000010000000000000000
  %B27 = fdiv ppc_fp128 %B10, %B16
  %B11 = fadd ppc_fp128 %B27, %B2
  %B1 = fdiv ppc_fp128 %B2, 0xM00000000000000010000000000000000
  %B14 = fdiv ppc_fp128 %B11, %B16
  %B4 = fdiv ppc_fp128 %B2, %B1
  %B12 = fsub ppc_fp128 0xM00000000000000000000000000000000, %B14
  %B8 = fsub ppc_fp128 0xM00000000000000000000000000000000, %B12
  %B6 = frem ppc_fp128 %B1, %B12
  %B18 = fsub ppc_fp128 0xM00000000000000000000000000000000, %B6
  %B9 = frem ppc_fp128 %B8, %B18
  %B22 = fdiv ppc_fp128 %B4, %B9
  %B5 = fmul ppc_fp128 %B22, %B9
  ret ppc_fp128 %B5
}

Assertion failed: (!carry), function addOrSubtractSignificand, file
llvm-project/llvm/lib/Support/APFloat.cpp, line 1540.
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace.
Stack dump:
0.      Program arguments: bin/opt -instcombine bugpoint-reduced-simplified.ll
1.      Running pass 'Function Pass Manager' on module
'bugpoint-reduced-simplified.ll'.
2.      Running pass 'Combine redundant instructions' on function
'@bitcast_bitcast_s_s_s'
0  opt                      0x000000010b2c2b35
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  opt                      0x000000010b2c1948 llvm::sys::RunSignalHandlers() +
248
2  opt                      0x000000010b2c3126 SignalHandler(int) + 262
3  libsystem_platform.dylib 0x00007fff6e0d85fd _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603338669783584
5  libsystem_c.dylib        0x00007fff6dfae808 abort + 120
6  libsystem_c.dylib        0x00007fff6dfadac6 err + 0
7  opt                      0x000000010c545be3
llvm::detail::IEEEFloat::addOrSubtractSignificand(llvm::detail::IEEEFloat
const&, bool) (.cold.3) + 35
8  opt                      0x000000010b1d1c90
llvm::detail::IEEEFloat::addOrSubtractSignificand(llvm::detail::IEEEFloat
const&, bool) + 1296
9  opt                      0x000000010b1d117d
llvm::detail::IEEEFloat::multiplySignificand(llvm::detail::IEEEFloat const&,
llvm::detail::IEEEFloat) + 589
10 opt                      0x000000010b1d3a66
llvm::detail::IEEEFloat::fusedMultiplyAdd(llvm::detail::IEEEFloat const&,
llvm::detail::IEEEFloat const&, llvm::APFloatBase::roundingMode) + 166
11 opt                      0x000000010b1dc714
llvm::detail::DoubleAPFloat::multiply(llvm::detail::DoubleAPFloat const&,
llvm::APFloatBase::roundingMode) + 916
12 opt                      0x000000010aa899ef
llvm::ConstantFoldBinaryInstruction(unsigned int, llvm::Constant*,
llvm::Constant*) + 5567
13 opt                      0x000000010aaa9bd7 llvm::ConstantExpr::get(unsigned
int, llvm::Constant*, llvm::Constant*, unsigned int, llvm::Type*) + 231
14 opt                      0x000000010a40d59e
llvm::ConstantFoldBinaryOpOperands(unsigned int, llvm::Constant*,
llvm::Constant*, llvm::DataLayout const&) + 1182
15 opt                      0x000000010a40b088
llvm::ConstantFoldInstruction(llvm::Instruction*, llvm::DataLayout const&,
llvm::TargetLibraryInfo const*) + 1224
16 opt                      0x000000010ad57323
combineInstructionsOverFunction(llvm::Function&, llvm::InstCombineWorklist&,
llvm::AAResults*, llvm::AssumptionCache&, llvm::TargetLibraryInfo&,
llvm::DominatorTree&, llvm::OptimizationRemarkEmitter&,
llvm::BlockFrequencyInfo*, llvm::ProfileSummaryInfo*, unsigned int,
llvm::LoopInfo*) + 1699
17 opt                      0x000000010ad58831
llvm::InstructionCombiningPass::runOnFunction(llvm::Function&) + 913
18 opt                      0x000000010ab5a723
llvm::FPPassManager::runOnFunction(llvm::Function&) + 1091
19 opt                      0x000000010ab5a9e8
llvm::FPPassManager::runOnModule(llvm::Module&) + 72
20 opt                      0x000000010ab5aec2
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 994
21 opt                      0x00000001093a7408 main + 10696
22 libdyld.dylib            0x00007fff6dedfcc9 start + 1
[1]    53415 abort      bin/opt -instcombine bugpoint-reduced-simplified.ll

Found by <a href="https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20034#c1">https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20034#c1</a></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>