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.
Showing the changes to tests (1 of 3 files). Show all
Unified · Split
| @@ -28,6 +28,9 @@ TESTS = \ · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | ifneq ($(CONFIG_bcheck),no) |
| 30 | 30 | TESTS += btest test1b |
| 31 | + ifndef CONFIG_WIN32 | |
| 32 | + TESTS += tccb | |
| 33 | + endif | |
| 31 | 34 | endif |
| 32 | 35 | ifeq ($(CONFIG_dll),no) |
| 33 | 36 | TESTS := $(filter-out dlltest, $(TESTS)) |
| @@ -198,6 +201,13 @@ btest: boundtest.c · 164 unmodified lines | ||
| 198 | 201 | done ;\ |
| 199 | 202 | echo Bound test OK |
| 200 | 203 | |
| 204 | +tccb: | |
| 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 | 211 | # speed test |
| 202 | 212 | speedtest: ex2 ex3 |
| 203 | 213 | @echo ------------ $@ ------------ |
| @@ -260,7 +270,7 @@ vla_test-run: vla_test$(EXESUF) · 56 unmodified lines | ||
| 260 | 270 | @echo ------------ $@ ------------ |
| 261 | 271 | ./vla_test$(EXESUF) |
| 262 | 272 | |
| 263 | −.PHONY: abitest vla_test | |
| 273 | +.PHONY: abitest vla_test tccb | |
| 264 | 274 | |
| 265 | 275 | asm-c-connect$(EXESUF): asm-c-connect-1.c asm-c-connect-2.c |
| 266 | 276 | $(TCC) -o $@ $^ |