From 358713fbf2e3c9bd9b41a61b5731d6d131689638 Mon Sep 17 00:00:00 2001 From: chrg6 Date: Fri, 13 Nov 2026 19:24:18 -0500 Subject: [PATCH] Trap unsigned wrap-around in tests/dlssg_pace_check.py, as its comment on overflows promised. The review found that the comment said an overflow in the period arithmetic fails the check, but -fsanitize=undefined does not trap unsigned wrap-around, and every period and time in runtime/dlssg_pace.h is a uint64_t. The check now builds with -fsanitize=undefined,unsigned-integer-overflow and the same -fsanitize-trap list, and the comment says why. It passes; a uint64_t subtraction that wraps traps under these flags and runs on under the old ones. Co-Authored-By: Claude Opus 5.5 --- tests/dlssg_pace_check.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/dlssg_pace_check.py b/tests/dlssg_pace_check.py index 25bd4c1c..03423abf 100644 --- a/tests/dlssg_pace_check.py +++ b/tests/dlssg_pace_check.py @@ -31,9 +31,12 @@ def main(): env = dict(os.environ) if os.name == 'nt' and MSYS_BIN.exists(): env['PATH'] = str(MSYS_BIN) + os.pathsep + env.get('PATH', '') - # undefined behaviour traps: an overflow in the period arithmetic fails the check instead of passing by chance - subprocess.check_call([compiler(), '-std=gnu11', '-O1', '-Wall', '-Werror', '-fsanitize=undefined', - '-fsanitize-trap=undefined', '-I', str(ROOT / 'runtime'), + # undefined behaviour and unsigned wrap-around trap: every period and time in dlssg_pace.h is a uint64_t, which + # -fsanitize=undefined alone lets wrap, so an overflow in that arithmetic fails the check instead of passing by + # chance + ub = 'undefined,unsigned-integer-overflow' + subprocess.check_call([compiler(), '-std=gnu11', '-O1', '-Wall', '-Werror', f'-fsanitize={ub}', + f'-fsanitize-trap={ub}', '-I', str(ROOT / 'runtime'), str(ROOT / 'tests' / 'dlssg_pace_check.c'), '-o', str(exe)], env=env) return subprocess.run([str(exe)], env=env).returncode