Tcl Source Code

View Ticket
Login
Ticket UUID: 1780870
Title: tcl segfaults when using intel compiler
Type: Bug Created on: 2007-08-24 09:10:50
Submitter: nobody Assigned to: msofer
Subsystem: 47. Bytecode Compiler Severity:
Priority: 9 Immediate Last modified: 2007-08-24 21:07:12
Status: Closed Closed by: msofer
Resolution: Fixed Closed on: 2007-08-24 11:22:10
Version: obsolete: 8.4.15
Description:
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)?
User Comments:
dgp added on 2007-08-24 21:07:12:
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.