Skip to content

Commit 9e4e13e

Browse files
authored
Merge pull request #366 from visitorckw/ci-add-undefined-behaviour-test
CI: Add undefined behavior test
2 parents 10fba76 + 17db3b2 commit 9e4e13e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ jobs:
6969
make ENABLE_EXT_A=0 ENABLE_JIT=1 clean check
7070
make ENABLE_EXT_F=0 ENABLE_JIT=1 clean check
7171
make ENABLE_EXT_C=0 ENABLE_JIT=1 clean check
72+
- name: undefined behavior test
73+
run: |
74+
make ENABLE_UBSAN=1 clean check
75+
make ENABLE_JIT=1 ENABLE_UBSAN=1 clean check
7276
7377
host-arm64:
7478
needs: [detect-code-related-file-changes]

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ ifeq ("$(CC_IS_EMCC)", "1")
136136
CFLAGS += -mtail-call
137137
endif
138138

139+
ENABLE_UBSAN ?= 0
140+
ifeq ("$(ENABLE_UBSAN)", "1")
141+
CFLAGS += -fsanitize=undefined -fno-sanitize=alignment -fno-sanitize-recover=all
142+
LDFLAGS += -fsanitize=undefined -fno-sanitize=alignment -fno-sanitize-recover=all
143+
endif
144+
139145
$(OUT)/emulate.o: CFLAGS += -foptimize-sibling-calls -fomit-frame-pointer -fno-stack-check -fno-stack-protector
140146

141147
# Clear the .DEFAULT_GOAL special variable, so that the following turns

0 commit comments

Comments
 (0)