From 167fdc3973b429b63b9056d83de879c9accb4eaa Mon Sep 17 00:00:00 2001 From: rajames Date: Fri, 2 Oct 2026 22:59:50 -0400 Subject: [PATCH] build(v4): make UBSan reports fatal in make sanitize Without -fno-sanitize-recover=all, UBSan prints a report and the run carries on to "all v4 tests passed". The sanitize build now aborts on the first report. Verified by rebuilding the test-side shift bug found in 981f4180 with these flags: the run exits 1 at the report. Both test binaries now also depend on v4/Makefile, so a flag change rebuilds them instead of leaving stale binaries in place. Co-Authored-By: Claude Opus 5.5 --- v4/Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/v4/Makefile b/v4/Makefile index bd8a2905..cfee95fa 100644 --- a/v4/Makefile +++ b/v4/Makefile @@ -56,16 +56,20 @@ endif # AddressSanitizer and UndefinedBehaviorSanitizer at both widths and runs them. # The optimized run catches logic errors, this one catches the out-of-bounds # ring index and the width-dependent shift that a logic-only test cannot see. +# -fno-sanitize-recover=all makes every UBSan report fatal: without it UBSan +# prints the report and carries on, and the run still says "passed". +# +# Both binaries depend on this Makefile, so a flag change rebuilds them. define TEST_RULE -$(BINDIR)/$(1)-$(notdir $(2)): $(2) $$(SRCS) $$(wildcard $(HERE)/include/v4/*.h) +$(BINDIR)/$(1)-$(notdir $(2)): $(2) $$(SRCS) $$(wildcard $(HERE)/include/v4/*.h) $(HERE)/Makefile @mkdir -p $(BINDIR) $$(CC) $$(CFLAGS) -I$(HERE)/include -DV4_CELL_BITS=$(1) \ $(2) $$(SRCS) -o $$@ -$(BINDIR)/san-$(1)-$(notdir $(2)): $(2) $$(SRCS) $$(wildcard $(HERE)/include/v4/*.h) +$(BINDIR)/san-$(1)-$(notdir $(2)): $(2) $$(SRCS) $$(wildcard $(HERE)/include/v4/*.h) $(HERE)/Makefile @mkdir -p $(BINDIR) $$(CC) $$(CSTD) $$(WARN) -O1 -g -fno-omit-frame-pointer \ - -fsanitize=address,undefined -I$(HERE)/include -DV4_CELL_BITS=$(1) \ + -fsanitize=address,undefined -fno-sanitize-recover=all -I$(HERE)/include -DV4_CELL_BITS=$(1) \ $(2) $$(SRCS) -o $$@ endef