[PATCH] D109072: Remove blank from NaN string representation

vdonaldson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 1 10:16:20 PDT 2021


vdonaldson created this revision.
vdonaldson added reviewers: klausler, PeteSteinfeld, jeanPerier.
vdonaldson added a project: Flang.
Herald added a subscriber: jdoerfert.
vdonaldson requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Flang front end function DumpHexadecimal generates a string representation of a REAL value.  When the value is a NaN, the string contains a blank, as in "NaN 0x7fc00000".  This function is used by lowering to generate a string that is then passed to llvm Support function ConvertFromStringSpecials, which does not expect a blank in the string.  Remove the blank to allow correct recognition of a NaN by this llvm function.

Note that function DumpHexadecimal is not exercised by the front end itself.  This functionality is only exercised by code that is not yet present in llvm.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109072

Files:
  flang/lib/Evaluate/real.cpp


Index: flang/lib/Evaluate/real.cpp
===================================================================
--- flang/lib/Evaluate/real.cpp
+++ flang/lib/Evaluate/real.cpp
@@ -439,7 +439,7 @@

 template <typename W, int P> std::string Real<W, P>::DumpHexadecimal() const {
   if (IsNotANumber()) {
-    return "NaN 0x"s + word_.Hexadecimal();
+    return "NaN0x"s + word_.Hexadecimal();
   } else if (IsNegative()) {
     return "-"s + Negate().DumpHexadecimal();
   } else if (IsInfinite()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109072.369966.patch
Type: text/x-patch
Size: 489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210901/90ee72ab/attachment.bin>


More information about the llvm-commits mailing list