<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_RESOLVED  bz_closed"
   title="RESOLVED DUPLICATE - assertion failure in APFloat.fusedMultiplyAdd with subnormal arguments"
   href="https://bugs.llvm.org/show_bug.cgi?id=44007">44007</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>assertion failure in APFloat.fusedMultiplyAdd with subnormal arguments
          </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>RESOLVED
          </td>
        </tr>

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

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

        <tr>
          <th>Component</th>
          <td>Support Libraries
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jay.foad@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>ehudkatz@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>ehudkatz@gmail.com
          </td>
        </tr>

        <tr>
          <th>Resolution</th>
          <td>DUPLICATE
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>RESOLVED
          </td>
        </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED DUPLICATE - assertion failure in APFloat.fusedMultiplyAdd with subnormal arguments"
   href="https://bugs.llvm.org/show_bug.cgi?id=44007#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED DUPLICATE - assertion failure in APFloat.fusedMultiplyAdd with subnormal arguments"
   href="https://bugs.llvm.org/show_bug.cgi?id=44007">bug 44007</a>
              from <span class="vcard"><a class="email" href="mailto:ehudkatz@gmail.com" title="Ehud Katz <ehudkatz@gmail.com>"> <span class="fn">Ehud Katz</span></a>
</span></b>
        <pre>

*** This bug has been marked as a duplicate of <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - assertion failure in APFloat.fusedMultiplyAdd with subnormal arguments"
   href="show_bug.cgi?id=44010">bug 44010</a> ***</pre>
        </div>
        <div>
        <pre>If I add this unit test:

diff --git a/llvm/unittests/ADT/APFloatTest.cpp
b/llvm/unittests/ADT/APFloatTest.cpp
index c76347ed056..a6398bbb684 100644
--- a/llvm/unittests/ADT/APFloatTest.cpp
+++ b/llvm/unittests/ADT/APFloatTest.cpp
@@ -530,6 +530,15 @@ TEST(APFloatTest, FMA) {
     EXPECT_FALSE(losesInfo);
     EXPECT_EQ(4.0f, M1.convertToFloat());
   }
+
+  // Regression test that failed an assertion.
+  {
+    APFloat f1(-8.85242279E-41f);
+    APFloat f2(2.0f);
+    APFloat f3(8.85242279E-41f);
+    f1.fusedMultiplyAdd(f2, f3, APFloat::rmNearestTiesToEven);
+    EXPECT_EQ(-8.85242279E-41f, f1.convertToFloat());
+  }
 }

 TEST(APFloatTest, MinNum) {

then it fails with an assertion failure:

ADTTests: /home/jayfoad2/git/llvm-project/llvm/lib/Support/APFloat.cpp:1521:
llvm::lostFraction llvm::detail::IEEEFloat::addOrSubtractSignificand(const
llvm::detail::IEEEFloat &, bool): Assertion `!carry' failed.

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff6890801 in __GI_abort () at abort.c:79
#2  0x00007ffff688039a in __assert_fail_base (fmt=0x7ffff6a077d8 "%s%s%s:%u:
%s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x20a334 "!carry",
file=file@entry=0x2280bf
"/home/jayfoad2/git/llvm-project/llvm/lib/Support/APFloat.cpp",
line=line@entry=1521, 
    function=function@entry=0x27527b "llvm::lostFraction
llvm::detail::IEEEFloat::addOrSubtractSignificand(const llvm::detail::IEEEFloat
&, bool)") at assert.c:92
#3  0x00007ffff6880412 in __GI___assert_fail (assertion=0x20a334 "!carry",
file=0x2280bf "/home/jayfoad2/git/llvm-project/llvm/lib/Support/APFloat.cpp",
line=1521, 
    function=0x27527b "llvm::lostFraction
llvm::detail::IEEEFloat::addOrSubtractSignificand(const llvm::detail::IEEEFloat
&, bool)") at assert.c:101
#4  0x00000000009499a6 in llvm::detail::IEEEFloat::addOrSubtractSignificand
(this=0x7fffffffd3d0, rhs=..., subtract=true) at
/home/jayfoad2/git/llvm-project/llvm/lib/Support/APFloat.cpp:1521
#5  0x000000000094918e in llvm::detail::IEEEFloat::multiplySignificand
(this=0x7fffffffd3d0, rhs=..., addend=0x7fffffffd390) at
/home/jayfoad2/git/llvm-project/llvm/lib/Support/APFloat.cpp:1066
#6  0x000000000094b726 in llvm::detail::IEEEFloat::fusedMultiplyAdd
(this=0x7fffffffd3d0, multiplicand=..., addend=...,
rounding_mode=llvm::APFloatBase::rmNearestTiesToEven) at
/home/jayfoad2/git/llvm-project/llvm/lib/Support/APFloat.cpp:1818
#7  0x00000000004bc29a in llvm::APFloat::fusedMultiplyAdd (this=0x7fffffffd3c8,
Multiplicand=..., Addend=..., RM=llvm::APFloatBase::rmNearestTiesToEven) at
/home/jayfoad2/git/llvm-project/llvm/include/llvm/ADT/APFloat.h:1017
#8  0x0000000000454202 in (anonymous namespace)::APFloatTest_FMA_Test::TestBody
(this=0xb14b00) at
/home/jayfoad2/git/llvm-project/llvm/unittests/ADT/APFloatTest.cpp:539
#9  0x0000000000a300be in
testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>
(object=0xb14b00, method=&virtual testing::Test::TestBody(), location=0x294442
"the test body") at
/home/jayfoad2/git/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2402
#10 0x0000000000a1ef62 in
testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>
(object=0xb14b00, method=&virtual testing::Test::TestBody(), location=0x294442
"the test body") at
/home/jayfoad2/git/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2455
#11 0x0000000000a0cd76 in testing::Test::Run (this=0xb14b00) at
/home/jayfoad2/git/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2474
#12 0x0000000000a0d633 in testing::TestInfo::Run (this=0xa95eb0) at
/home/jayfoad2/git/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2656
#13 0x0000000000a0db8c in testing::TestCase::Run (this=0xa95bd0) at
/home/jayfoad2/git/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2774
#14 0x0000000000a132d1 in testing::internal::UnitTestImpl::RunAllTests
(this=0xa95140) at
/home/jayfoad2/git/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:4649
#15 0x0000000000a32c5e in
testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl,
bool> (object=0xa95140, 
    method=(bool
(testing::internal::UnitTestImpl::*)(testing::internal::UnitTestImpl * const))
0xa12ff0 <testing::internal::UnitTestImpl::RunAllTests()>, location=0x21ebee
"auxiliary test code (environments or event listeners)")
    at
/home/jayfoad2/git/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2402
#16 0x0000000000a208c2 in
testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl,
bool> (object=0xa95140, 
    method=(bool
(testing::internal::UnitTestImpl::*)(testing::internal::UnitTestImpl * const))
0xa12ff0 <testing::internal::UnitTestImpl::RunAllTests()>, location=0x21ebee
"auxiliary test code (environments or event listeners)")
    at
/home/jayfoad2/git/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2455
#17 0x0000000000a12fc2 in testing::UnitTest::Run (this=0xa82bc0
<testing::UnitTest::GetInstance()::instance>) at
/home/jayfoad2/git/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:4257
#18 0x0000000000a05451 in RUN_ALL_TESTS () at
/home/jayfoad2/git/llvm-project/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233
#19 0x0000000000a053e7 in main (argc=1, argv=0x7fffffffde48) at
/home/jayfoad2/git/llvm-project/llvm/utils/unittest/UnitTestMain/TestMain.cpp:50

I suspect that IEEEFloat::addOrSubtractSignificand is making some assumptions
about subnormal values, that fusedMultiplyAdd is not respecting.</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>