[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 00755416 1/4: Prevent UB detected by UBSan wi
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 00755416 1/4: Prevent UB detected by UBSan with clang but not with gcc |
Date: |
Wed, 15 Jun 2022 11:18:57 -0400 (EDT) |
branch: master
commit 00755416c348abba1979701a9abc328a7c0e32e9
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Prevent UB detected by UBSan with clang but not with gcc
---
input_test.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/input_test.cpp b/input_test.cpp
index ea7f0308..1548565a 100644
--- a/input_test.cpp
+++ b/input_test.cpp
@@ -171,13 +171,13 @@ void input_test::test_product_database()
// gcc adds a warning like clang's (pragma above).
db.query_into(DB_ChildRiderMinAmt, a);
LMI_TEST_EQUAL(25000, a);
-#endif // 0
// UBSan complains about the example above, both with gcc and with
// clang. It complains about the next example only with clang, but
// not with gcc, even though the two examples are equivalent. See:
// https://lists.nongnu.org/archive/html/lmi/2022-06/msg00049.html
auto const b {db.query<oenum_alb_or_anb>(DB_ChildRiderMinAmt)};
LMI_TEST_EQUAL(25000, b);
+#endif // 0
#if defined LMI_CLANG
# pragma clang diagnostic pop