From 942ffdc8572fec5cec89fdd62d76ee76adc20eb4 Mon Sep 17 00:00:00 2001 From: Quinn Date: Thu, 4 Sep 2025 10:39:30 +0200 Subject: [PATCH] add a flag when debugging to generate SIGFPE when signed integer overflow occurs. (this is UB) --- makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/makefile b/makefile index 35b9d1d..0025705 100644 --- a/makefile +++ b/makefile @@ -38,14 +38,14 @@ endif ifeq ($(DEBUG),1) PROF = dbg CFLAGS += -UNDEBUG -Og -g -Wextra -Wpedantic -CFLAGS += $(if $(filter 1,$(ISWIN)),,-fsanitize=address,undefined) -LDFLAGS += $(if $(filter 1,$(ISWIN)),,-fsanitize=address,undefined) +CFLAGS += $(if $(filter 1,$(ISWIN)),,-fsanitize=address,undefined) -ftrapv +LDFLAGS += $(if $(filter 1,$(ISWIN)),,-fsanitize=address,undefined) -ftrapv # |--profile: testing else ifeq ($(DEBUG),test) PROF = test CFLAGS += -UNDEBUG -O2 -g -CFLAGS += $(if $(filter 1,$(ISWIN)),,-fsanitize=address) -LDFLAGS += $(if $(filter 1,$(ISWIN)),,-fsanitize=address) +CFLAGS += $(if $(filter 1,$(ISWIN)),,-fsanitize=address) -ftrapv +LDFLAGS += $(if $(filter 1,$(ISWIN)),,-fsanitize=address) -ftrapv else PROF = rel CFLAGS += -DNDEBUG -O2