Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2007-08-24
21:07 • Ticket [1780870fff] tcl segfaults when using intel compiler status still Clo... artifact: 64e35d6cb7 user: dgp
18:22 • Closed ticket [1780870fff]. artifact: 73a71a6322 user: msofer
18:13 • Ticket [1780870fff]: 1 change artifact: 24b3f5b2e4 user: dkf
09:10 • New ticket [1780870fff]. artifact: 840336e0b8 user: nobody

tcl segfaults when using intel compiler

Closed / Fixed1780870fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2007-08-24 09:10:50
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)?
dkf Ticket [1780870fff]: 1 change [History diff]2007-08-24 18:13:11
msofer Closed ticket [1780870fff]. [History diff]2007-08-24 18:22:10
dgpplain2007-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.
Log in (anonymous is fine) to add a comment.