When compiling tcl with the intel compiler (icc 10.0 20070426 - x386, linux) and optimisation enabled, the resulting executable segfaults. The issue is in the file generic/tclCompile.c, function TclFixupForwardJump.
What the compiler apparently does not understand/screws up in optimisation is the loop
for (numBytes = envPtr->codeNext-jumpPc-2, p = jumpPc+2+numBytes-1;
numBytes > 0; numBytes--, p--) {
p[3] = p[0];
}
Changing p to 'volatile' solves the problem - e.g. changing the line
unsigned char* jumpPc,p;
to
unsigned char* jumpPc;
volatile unsigned char* p;
It would be great, if the above would not be dismissed as a 'compiler issue'. I think the best solution would be if someone who is familiar with the code could convert the loop into a call to memmove (assuming that call is available on most platforms)?
Logged In: YES
user_id=80530
Originator: NO
Now, that a workaround is in Tcl's source code,
I hope someone will report this "compiler issue"
to the maintainers of the misbehaving compiler.