When building tcc with
./configure --extra-cflags='-Wall -g -O2 -fsanitize=address' \
--extra-ldflags='-fsanitize=address'
Then the test suite can be run with gcc's address-sanitizer enabled:
make test
The address-sanitizer can also successfully catch the use-after-free bug
revealed by valgrind and fixed here:
http://lists.nongnu.org/archive/html/tinycc-devel/2018-12/msg00002.html
---
tests/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/Makefile b/tests/Makefile
index 5f6777d..fd843c7 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -134,7 +134,7 @@ dlltest:
./tcc2$(EXESUF) $(TCCFLAGS) $(RUN_TCC) -run $(TOPSRC)/examples/ex1.c
ifndef CONFIG_WIN32
@echo ------------ $@ with PIC ------------
- $(CC) $(CFLAGS) -fPIC $(NATIVE_DEFINES) -DLIBTCC_AS_DLL -c
$(TOPSRC)/libtcc.c
+ $(CC) $(filter-out -f%,$(CFLAGS)) -fPIC $(NATIVE_DEFINES)
-DLIBTCC_AS_DLL -c $(TOPSRC)/libtcc.c
$(TCC) libtcc.o $(LIBS) -shared -o libtcc2$(DLLSUF)
$(TCC) $(NATIVE_DEFINES) -DONE_SOURCE=0 $(TOPSRC)/tcc.c
libtcc2$(DLLSUF) $(LIBS) -Wl,-rpath=. -o tcc2$(EXESUF)
./tcc2$(EXESUF) $(TCCFLAGS) $(RUN_TCC) -run $(TOPSRC)/examples/ex1.c
--
2.11.0.295.gd7dffce
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel