[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master a9d9e02 1/4: Avoid an apparently incorrect gc
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master a9d9e02 1/4: Avoid an apparently incorrect gcc-9 diagnostic |
Date: |
Thu, 30 Apr 2020 15:38:44 -0400 (EDT) |
branch: master
commit a9d9e02b6d1e017a251e6982303000ad07700bf5
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Avoid an apparently incorrect gcc-9 diagnostic
See:
https://lists.nongnu.org/archive/html/lmi/2020-04/msg00016.html
et seqq.
---
financial_test.cpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/financial_test.cpp b/financial_test.cpp
index b274c63..75a0df4 100644
--- a/financial_test.cpp
+++ b/financial_test.cpp
@@ -191,7 +191,14 @@ int test_main(int, char*[])
static double const i = .05;
static double const one_plus_i = 1.0 + i;
std::vector<double> accum_p(p.size());
+#if defined __GNUC__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wnull-dereference"
+#endif // defined __GNUC__
accum_p[0] = p[0] * one_plus_i;
+#if defined __GNUC__
+# pragma GCC diagnostic pop
+#endif // defined __GNUC__
for(int j = 1; j < lmi::ssize(p); ++j)
{
accum_p[j] = (accum_p[j - 1] + p[j]) * one_plus_i;