[PATCH] D86997: [APFloat] Fix uninitialized variable in IEEEFloat constructor
Yang Fan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 1 18:46:46 PDT 2020
nullptr.cpp created this revision.
Herald added subscribers: llvm-commits, dexonsmith, hiraditya.
Herald added a project: LLVM.
nullptr.cpp requested review of this revision.
Constructor `IEEEFloat(const fltSemantics &ourSemantics)` does not initialize
member variable `exponent`. Fix by delegating to member function `makeZero()`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D86997
Files:
llvm/include/llvm/ADT/APFloat.h
llvm/lib/Support/APFloat.cpp
Index: llvm/lib/Support/APFloat.cpp
===================================================================
--- llvm/lib/Support/APFloat.cpp
+++ llvm/lib/Support/APFloat.cpp
@@ -925,8 +925,7 @@
IEEEFloat::IEEEFloat(const fltSemantics &ourSemantics) {
initialize(&ourSemantics);
- category = fcZero;
- sign = false;
+ makeZero(false);
}
// Delegate to the previous constructor, because later copy constructor may
Index: llvm/include/llvm/ADT/APFloat.h
===================================================================
--- llvm/include/llvm/ADT/APFloat.h
+++ llvm/include/llvm/ADT/APFloat.h
@@ -249,7 +249,7 @@
/// \name Constructors
/// @{
- IEEEFloat(const fltSemantics &); // Default construct to 0.0
+ IEEEFloat(const fltSemantics &); // Default construct to +0.0
IEEEFloat(const fltSemantics &, integerPart);
IEEEFloat(const fltSemantics &, uninitializedTag);
IEEEFloat(const fltSemantics &, const APInt &);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86997.289340.patch
Type: text/x-patch
Size: 941 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200902/8a89fac2/attachment.bin>
More information about the llvm-commits
mailing list