TCC crashes on gosub after long command line

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Jul 31, 2010
5
0
#1
I spent about a day tracking down and finally reproducing a strange crash in TCC. The crash occurs on a gosub with arguments to a label in a named script.

Later .. I found an easier way to reproduce.
Create two batch files:

BUG1.btm
setlocal

set BUG1=%[_batchname]
call Bug2.btm
quit 0

:LogError [Text1 File1 Find1]
@echo BUG1 : LogError called OK
@echo Text1 = %[Text1]
return

BUG2.btm
grep.exe This statement has a command line length of more than 400 or so characters This statement has a command line length of more than 400 or so characters This statement has a command line length of more than 400 or so characters This statement has a command line length of more than 400 or so characters This statement has a command line length of more than 400 or so characters This statement has a command line length of more than 400 or so characters
rem grep.exe This statement has a short command line
pause gosub is next
gosub "%[BUG1]" LogError "This"
quit 0

Run BUG1.btm
Crashes on Vista with tcc 11.00.51
rem out the first grep.exe, un-rem the second and it works fine.

Old comment, only of historical interest ;-) ...
A zip file is attached that reproduces the crash (on this Windows Vista system). Running CrashTcc.btm:
- Unsets all environment variables.
- Restores the original environment variable from CrashTcc.env.txt
- Sets TMP to this directory.
- Calls clean\clean-lib.mvs2010.win.debuga.bandc6.gen.btm, which:
- Runs an exe with a long (400+ characters) command line
- Calls bin/mm.btm by:
gosub "%[MM]" LogError error-text
and dies

There are a few explanatory
pause
statements just before the crash point

TCC does NOT crash:
- if the environment variables are not restored
- if the executed command has a shorter command line.

The command is currently a GNU grep.exe; I tried various ones One utility I have here subsequently gave the error:
TCC: H:\v\hai\trunk\hai\bin\mm.btm [1756] Label not found "????????????????????????"
(The ?'s appeared as square box characters on the console).

If you edit to use a shorter command then it WORKS OK
It seems the GOSUB only crashes after running an exe with a LONG COMMAND LINE!


Additional info:
CrashTcc.pdf The crash popup
CrashTcc.ver.txt ver /r details (I had the problem with 11.00.48 and upgraded to 51, without avail)
TccInstalDir A copy of the tcc install directory