Index: lib/AsmParser/LLLexer.cpp =================================================================== --- lib/AsmParser/LLLexer.cpp +++ lib/AsmParser/LLLexer.cpp @@ -937,7 +937,8 @@ } } - APFloatVal = APFloat(std::atof(TokStart)); + APFloatVal = APFloat(APFloat::IEEEdouble, + StringRef(TokStart, CurPtr - TokStart)); return lltok::APFloat; } @@ -973,6 +974,7 @@ } } - APFloatVal = APFloat(std::atof(TokStart)); + APFloatVal = APFloat(APFloat::IEEEdouble, + StringRef(TokStart, CurPtr - TokStart)); return lltok::APFloat; } Index: unittests/AsmParser/AsmParserTest.cpp =================================================================== --- unittests/AsmParser/AsmParserTest.cpp +++ unittests/AsmParser/AsmParserTest.cpp @@ -16,6 +16,10 @@ #include "llvm/Support/SourceMgr.h" #include "gtest/gtest.h" +#if !LLVM_ON_WIN32 +#include +#endif + using namespace llvm; namespace { @@ -80,6 +84,19 @@ ASSERT_TRUE(isa(V)); EXPECT_TRUE(cast(V)->isExactlyValue(3.5)); + // https://llvm.org/bugs/show_bug.cgi?id=25788 +#if !LLVM_ON_WIN32 + char *oldLoc = setlocale(LC_ALL, NULL); + if (setlocale(LC_ALL, "fr_FR.UTF-8")) { + V = parseConstantValue("double 1.25e+01", Error, M); + setlocale(LC_ALL, oldLoc); + ASSERT_TRUE(V); + EXPECT_TRUE(V->getType()->isDoubleTy()); + ASSERT_TRUE(isa(V)); + EXPECT_TRUE(cast(V)->isExactlyValue(12.5)); + } +#endif + V = parseConstantValue("i32 42", Error, M); ASSERT_TRUE(V); EXPECT_TRUE(V->getType()->isIntegerTy());