WAD TCC Crash

Sep 8, 2013
5
0
TCC 15.00.26 x64 Windows 7 [Version 6.1.7601]

Rex, I've been using TCC/4NT for years. Love it. I found the following .bat file causes TCC to crash:

Code:
call :list %include%
goto :eof
 
:list
@FOR /F "tokens=1* delims=;" %%a IN ("%*") DO @if not {%%a}=={} @echo %%a&@call %0 %%b&goto :eof
goto :eof
 
May 20, 2008
9,700
67
Syracuse, NY, USA
TCC and CMD handle IF's command differently. Fix it with parentheses:
Code:
(@echo %%a&@call %0 %%b&goto :eof)
Read about it in the help for IF, and read about the initialization directive "Duplicate CMD Bugs".
 
May 20, 2008
9,700
67
Syracuse, NY, USA
Thanks. That fixes it, though TCC generating an unhandled exception probably isn't good.
TCC usually catches nesting that's too deep without crashing. Maybe Rex will look into your example.
Code:
v:\> type callme.btm
call %0
quit

:foo
echo bar

v:\> callme.btm
TCC: V:\callme.btm [1]  Exceeded batch nesting limit
 

rconn

Administrator
Staff member
May 14, 2008
11,312
104
Thanks. That fixes it, though TCC generating an unhandled exception probably isn't good.
It's difficult for TCC to detect infinite loops of that nature (calling multiple commands within a single command) without a lot of extra code, which slows everybody down for an exceedingly minor benefit. (I.e., running a bizarre CMD script that is relying on undocumented CMD behavior, without telling TCC you're running a bizarre CMD script.)