Page MenuHomePhabricator

Fix APFloat from string conversion for Inf
ClosedPublic

Authored by yrouban on Sep 19 2017, 2:00 AM.

Details

Summary

The method IEEEFloat::convertFromStringSpecials() does not recognize the "+Inf" and "-Inf" strings but these strings are printed for the double Infinities by the IEEEFloat::toString().

This patch adds the "+Inf" and "-Inf" strings to the list of recognized patterns in IEEEFloat::convertFromStringSpecials().

Diff Detail

Repository
rL LLVM

Event Timeline

yrouban created this revision.Sep 19 2017, 2:00 AM
yrouban edited the summary of this revision. (Show Details)Sep 20 2017, 11:08 PM
yrouban added reviewers: gottesmm, bkramer.

What can I do to make a progress with this patch?

skatkov accepted this revision.Oct 10 2017, 4:35 AM

LGTM.

This revision is now accepted and ready to land.Oct 10 2017, 4:35 AM

LGTM.

Could you please land this patch?

Will land it in a 24-hours if there is no objections from others.

This revision was automatically updated to reflect the committed changes.

I'm afraid this has broken Windows builds (http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/12860/steps/test/logs/stdio).

The test fails with

[ RUN ] APFloatTest.fromToStringSpecials

C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\unittests\ADT\APFloatTest.cpp(856): error: Expected: "+Inf"

To be equal to: roundTrip("+Inf")

Which is: ""

C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\unittests\ADT\APFloatTest.cpp(857): error: Expected: "+Inf"

To be equal to: roundTrip("INFINITY")

Which is: ""

C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\unittests\ADT\APFloatTest.cpp(858): error: Expected: "+Inf"

To be equal to: roundTrip("inf")

Which is: ""

C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\unittests\ADT\APFloatTest.cpp(859): error: Expected: "-Inf"

To be equal to: roundTrip("-Inf")

Which is: ""

C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\unittests\ADT\APFloatTest.cpp(860): error: Expected: "-Inf"

To be equal to: roundTrip("-INFINITY")

Which is: ""

C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\unittests\ADT\APFloatTest.cpp(861): error: Expected: "-Inf"

To be equal to: roundTrip("-inf")

Which is: ""

C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\unittests\ADT\APFloatTest.cpp(862): error: Expected: "NaN"

To be equal to: roundTrip("NaN")

Which is: ""

C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\unittests\ADT\APFloatTest.cpp(863): error: Expected: "NaN"

To be equal to: roundTrip("nan")

Which is: ""

C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\unittests\ADT\APFloatTest.cpp(864): error: Expected: "NaN"

To be equal to: roundTrip("-NaN")

Which is: ""

C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\unittests\ADT\APFloatTest.cpp(865): error: Expected: "NaN"

To be equal to: roundTrip("-nan")

Which is: ""

[ FAILED ] APFloatTest.fromToStringSpecials (24 ms)

I have reverted the patch as rL316158.

Thank you guys, Yevgeny, please take a look.

Thank you guys, Yevgeny, please take a look.

OK, I will.

yrouban reopened this revision.Dec 14 2017, 3:45 AM
This revision is now accepted and ready to land.Dec 14 2017, 3:45 AM
yrouban updated this revision to Diff 126926.Dec 14 2017, 3:47 AM
yrouban added a reviewer: anna.

fixed bug in APFloatTest.cpp to not return reference to a temporary string.

anna accepted this revision.Dec 14 2017, 6:46 AM

lgtm.

just for information of folks following along - we had caught this as a heap-use-after-free error using an ASAN build. I think this may have manifested as the Windows failure that caused the revert originally.

Committers, could you please try landing the patch?

This revision was automatically updated to reflect the committed changes.