From 3a0704710ca9f44b6889e94a68884352147275d4 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 a437a08..62a0c91 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