[libcxx] r268285 - Initialize local doubles to NaN. Patch from STL at microsoft.com

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Mon May 2 12:20:16 PDT 2016


Author: ericwf
Date: Mon May  2 14:20:16 2016
New Revision: 268285

URL: http://llvm.org/viewvc/llvm-project?rev=268285&view=rev
Log:
Initialize local doubles to NaN. Patch from STL at microsoft.com

Modified:
    libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
    libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp

Modified: libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp?rev=268285&r1=268284&r2=268285&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp (original)
+++ libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp Mon May  2 14:20:16 2016
@@ -24,6 +24,7 @@
 #include <iterator>
 #include <numeric>
 #include <cassert>
+#include <limits>
 
 template <class T>
 inline
@@ -60,10 +61,10 @@ int main()
         }
         std::sort(u.begin(), u.end());
         int kp = -1;
-        double a;
-        double m;
-        double bk;
-        double c;
+        double a = std::numeric_limits<double>::quiet_NaN();
+        double m = std::numeric_limits<double>::quiet_NaN();
+        double bk = std::numeric_limits<double>::quiet_NaN();
+        double c = std::numeric_limits<double>::quiet_NaN();
         std::vector<double> areas(Np);
         double S = 0;
         for (int i = 0; i < areas.size(); ++i)
@@ -110,10 +111,10 @@ int main()
         }
         std::sort(u.begin(), u.end());
         int kp = -1;
-        double a;
-        double m;
-        double bk;
-        double c;
+        double a = std::numeric_limits<double>::quiet_NaN();
+        double m = std::numeric_limits<double>::quiet_NaN();
+        double bk = std::numeric_limits<double>::quiet_NaN();
+        double c = std::numeric_limits<double>::quiet_NaN();
         std::vector<double> areas(Np);
         double S = 0;
         for (int i = 0; i < areas.size(); ++i)
@@ -160,10 +161,10 @@ int main()
         }
         std::sort(u.begin(), u.end());
         int kp = -1;
-        double a;
-        double m;
-        double bk;
-        double c;
+        double a = std::numeric_limits<double>::quiet_NaN();
+        double m = std::numeric_limits<double>::quiet_NaN();
+        double bk = std::numeric_limits<double>::quiet_NaN();
+        double c = std::numeric_limits<double>::quiet_NaN();
         std::vector<double> areas(Np);
         double S = 0;
         for (int i = 0; i < areas.size(); ++i)
@@ -210,10 +211,10 @@ int main()
         }
         std::sort(u.begin(), u.end());
         int kp = -1;
-        double a;
-        double m;
-        double bk;
-        double c;
+        double a = std::numeric_limits<double>::quiet_NaN();
+        double m = std::numeric_limits<double>::quiet_NaN();
+        double bk = std::numeric_limits<double>::quiet_NaN();
+        double c = std::numeric_limits<double>::quiet_NaN();
         std::vector<double> areas(Np);
         double S = 0;
         for (int i = 0; i < areas.size(); ++i)
@@ -260,10 +261,10 @@ int main()
         }
         std::sort(u.begin(), u.end());
         int kp = -1;
-        double a;
-        double m;
-        double bk;
-        double c;
+        double a = std::numeric_limits<double>::quiet_NaN();
+        double m = std::numeric_limits<double>::quiet_NaN();
+        double bk = std::numeric_limits<double>::quiet_NaN();
+        double c = std::numeric_limits<double>::quiet_NaN();
         std::vector<double> areas(Np);
         double S = 0;
         for (int i = 0; i < areas.size(); ++i)
@@ -310,10 +311,10 @@ int main()
         }
         std::sort(u.begin(), u.end());
         int kp = -1;
-        double a;
-        double m;
-        double bk;
-        double c;
+        double a = std::numeric_limits<double>::quiet_NaN();
+        double m = std::numeric_limits<double>::quiet_NaN();
+        double bk = std::numeric_limits<double>::quiet_NaN();
+        double c = std::numeric_limits<double>::quiet_NaN();
         std::vector<double> areas(Np);
         double S = 0;
         for (int i = 0; i < areas.size(); ++i)

Modified: libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp?rev=268285&r1=268284&r2=268285&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp (original)
+++ libcxx/trunk/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp Mon May  2 14:20:16 2016
@@ -22,6 +22,7 @@
 #include <numeric>
 #include <algorithm>   // for sort
 #include <cassert>
+#include <limits>
 
 template <class T>
 inline
@@ -59,10 +60,10 @@ int main()
         }
         std::sort(u.begin(), u.end());
         int kp = -1;
-        double a;
-        double m;
-        double bk;
-        double c;
+        double a = std::numeric_limits<double>::quiet_NaN();
+        double m = std::numeric_limits<double>::quiet_NaN();
+        double bk = std::numeric_limits<double>::quiet_NaN();
+        double c = std::numeric_limits<double>::quiet_NaN();
         std::vector<double> areas(Np);
         double S = 0;
         for (int i = 0; i < areas.size(); ++i)




More information about the cfe-commits mailing list