lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 8f25a9bd 5/8: Resolve an issue identified by


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 8f25a9bd 5/8: Resolve an issue identified by UBSAN
Date: Mon, 6 Jun 2022 18:40:33 -0400 (EDT)

branch: master
commit 8f25a9bd977df3db393eb2ab16ce1ef6d6e18a84
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Resolve an issue identified by UBSAN
    
    Suppressed one instance of undefined behavior, which UBSAN flagged.
    Marked another one that UBSAN doesn't complain about.
---
 input_test.cpp | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/input_test.cpp b/input_test.cpp
index ba679ccb..9966169b 100644
--- a/input_test.cpp
+++ b/input_test.cpp
@@ -160,9 +160,19 @@ void input_test::test_product_database()
 #   pragma clang diagnostic ignored 
"-Wtautological-constant-out-of-range-compare"
 #endif // defined LMI_CLANG
 
-    // This value corresponds to no enumerator, but C++ allows that.
+#if 0
+    // This value corresponds to no enumerator. Formerly, the
+    // resulting value was unspecified:
+    //   https://cplusplus.github.io/CWG/issues/1094.html
+    // but now this is undefined behavior:
+    //   https://cplusplus.github.io/CWG/issues/1766.html
+    // and therefore the test is suppressed, but retained as
+    // a cautionary example, and as a convenient test in case
+    // gcc adds a warning like clang's (pragma above).
     db.query_into(DB_ChildRiderMinAmt, a);
     LMI_TEST_EQUAL(25000, a);
+#endif // 0
+    // UBSAN doesn't complain about this; shouldn't it?
     auto const b {db.query<oenum_alb_or_anb>(DB_ChildRiderMinAmt)};
     LMI_TEST_EQUAL(25000, b);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]