VMCore/AsmWriter.cpp: Use APFloat instead of atof(3).
authorNAKAMURA Takumi <geek4civic@gmail.com>
Thu, 16 Feb 2012 04:19:15 +0000 (04:19 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Thu, 16 Feb 2012 04:19:15 +0000 (04:19 +0000)
atof(3) might behave differently among platforms.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150661 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/AsmWriter.cpp

index 7bec783b0d31ae24f9e43fbeddd84372f02442ba..21d4566a08057684a932715da9c8fa48091b5893 100644 (file)
@@ -733,7 +733,7 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
             ((StrVal[0] == '-' || StrVal[0] == '+') &&
              (StrVal[1] >= '0' && StrVal[1] <= '9'))) {
           // Reparse stringized version!
-          if (atof(StrVal.c_str()) == Val) {
+          if (APFloat(APFloat::IEEEdouble, StrVal).convertToDouble() == Val) {
             Out << StrVal.str();
             return;
           }