History

Allow tcc to run with bounds checking enabled

tcc failed to run with bounds checking enabled because the functions rt_wait_sem, rt_post_sem and _rt_error where defined twice. This is solved by making them weak in tccrun.c Also a nested lock was present when setting TCC_BOUNDS_PRINT_CALLS=1 This is solved in lib/bt-exe.c by moving lock/unlock code. Also added a testcase in tests/Makefile to test tcc with bounds checking enabled.

herman ten brugge committed 2 years ago

Commit 8d8d75c1 parent f2e8b2a3 files · +25 −9Browse files

Showing the changes to tests (1 of 3 files). Show all

Unified · Split

tests/Makefile+11−1
@@ -28,6 +28,9 @@ TESTS = \ · 27 unmodified lines
28 28
29ifneq ($(CONFIG_bcheck),no)29ifneq ($(CONFIG_bcheck),no)
30 TESTS += btest test1b30 TESTS += btest test1b
31 ifndef CONFIG_WIN32
32 TESTS += tccb
33 endif
31endif34endif
32ifeq ($(CONFIG_dll),no)35ifeq ($(CONFIG_dll),no)
33 TESTS := $(filter-out dlltest, $(TESTS))36 TESTS := $(filter-out dlltest, $(TESTS))
@@ -198,6 +201,13 @@ btest: boundtest.c · 164 unmodified lines
198 done ;\201 done ;\
199 echo Bound test OK202 echo Bound test OK
200 203
204tccb:
205 @echo ------------ $@ ------------
206 $(TCC) -b $(TOPSRC)/tcc.c $(TCCFLAGS) $(NATIVE_DEFINES) -o v1-tcc$(EXESUF)
207 mv v1-tcc$(EXESUF) v2-tcc$(EXESUF)
208 ./v2-tcc$(EXESUF) -b $(TOPSRC)/tcc.c $(TCCFLAGS) $(NATIVE_DEFINES) -o v1-tcc$(EXESUF)
209 cmp -s v1-tcc$(EXESUF) v2-tcc$(EXESUF) && echo "Bound-Test tcc OK"
210
201# speed test211# speed test
202speedtest: ex2 ex3212speedtest: ex2 ex3
203 @echo ------------ $@ ------------213 @echo ------------ $@ ------------
@@ -260,7 +270,7 @@ vla_test-run: vla_test$(EXESUF) · 56 unmodified lines
260 @echo ------------ $@ ------------270 @echo ------------ $@ ------------
261 ./vla_test$(EXESUF)271 ./vla_test$(EXESUF)
262 272
263.PHONY: abitest vla_test273.PHONY: abitest vla_test tccb
264 274
265asm-c-connect$(EXESUF): asm-c-connect-1.c asm-c-connect-2.c275asm-c-connect$(EXESUF): asm-c-connect-1.c asm-c-connect-2.c
266 $(TCC) -o $@ $^276 $(TCC) -o $@ $^

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t