Skip to content

Commit 7b257a8

Browse files
committed
Enable leak sanitizer for memory leak detection
Previously for sanitizer tests, only address sanitizer is enabled, in this patch, leak sanitizer is also enabled to detect any possible memory leak happened in compilation. Close #275.
1 parent e95fccc commit 7b257a8

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ SNAPSHOTS := $(foreach SNAPSHOT_ARCH,$(ARCHS), $(patsubst tests/%.c, tests/snaps
5252

5353
all: config bootstrap
5454

55-
sanitizer: CFLAGS += -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer -O0
56-
sanitizer: LDFLAGS += -fsanitize=address -fsanitize=undefined
55+
sanitizer: CFLAGS += -fsanitize=address -fsanitize=undefined -fsanitize=leak -fno-omit-frame-pointer -O0
56+
sanitizer: LDFLAGS += -fsanitize=address -fsanitize=undefined -fsanitize=leak
5757
sanitizer: config $(OUT)/$(STAGE0)-sanitizer
5858
$(VECHO) " Built stage 0 compiler with sanitizers\n"
5959

src/ssa.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -903,8 +903,6 @@ void bb_unwind_phi(func_t *func, basic_block_t *bb)
903903
for (phi_operand_t *operand = insn->phi_ops; operand;
904904
operand = operand->next)
905905
append_unwound_phi_insn(operand->from, insn->rd, operand->var);
906-
/* TODO: Release memory allocated for phi instruction to prevent leaks
907-
*/
908906
}
909907

910908
bb->insn_list.head = insn;

0 commit comments

Comments
 (0)