add a flag when debugging to generate SIGFPE when signed integer overflow occurs. (this is UB)

This commit is contained in:
2025-09-04 10:39:30 +02:00
parent b72b8eaee1
commit 3a0704710c

View File

@@ -38,14 +38,14 @@ endif
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)
PROF = dbg PROF = dbg
CFLAGS += -UNDEBUG -Og -g -Wextra -Wpedantic CFLAGS += -UNDEBUG -Og -g -Wextra -Wpedantic
CFLAGS += $(if $(filter 1,$(ISWIN)),,-fsanitize=address,undefined) CFLAGS += $(if $(filter 1,$(ISWIN)),,-fsanitize=address,undefined) -ftrapv
LDFLAGS += $(if $(filter 1,$(ISWIN)),,-fsanitize=address,undefined) LDFLAGS += $(if $(filter 1,$(ISWIN)),,-fsanitize=address,undefined) -ftrapv
# |--profile: testing # |--profile: testing
else ifeq ($(DEBUG),test) else ifeq ($(DEBUG),test)
PROF = test PROF = test
CFLAGS += -UNDEBUG -O2 -g CFLAGS += -UNDEBUG -O2 -g
CFLAGS += $(if $(filter 1,$(ISWIN)),,-fsanitize=address) CFLAGS += $(if $(filter 1,$(ISWIN)),,-fsanitize=address) -ftrapv
LDFLAGS += $(if $(filter 1,$(ISWIN)),,-fsanitize=address) LDFLAGS += $(if $(filter 1,$(ISWIN)),,-fsanitize=address) -ftrapv
else else
PROF = rel PROF = rel
CFLAGS += -DNDEBUG -O2 CFLAGS += -DNDEBUG -O2