Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 21663c3814c54568cc3384f9538524565f040d2a
Ticket: 494348ffffffffffffffffffffffffffffffffff
foreach crashes in recursion
User & Date: dkf on 2001-12-19 23:04:26
Changes

  1. icomment:
    Logged In: YES 
    user_id=79902
    
    I'd still love to see a way to reproduce this in a standard shell (I *can't* cause it to crash with the above code, even if I 
    force it to use the code in tclCmdAH.c instead of the bytecodes) if for no other reason than to form the basis of a test so 
    we can make sure that this fault can't recur.  Still, a minimal attempt at fixing it would involve doing Tcl_IncrRefCount() on 
    all the arguments to foreach before the iteration, and Tcl_DecrRefCount() on them all prior to exit from the function.  The 
    primary alternative is a heavyweight copy, and that would make the performance suck for what is, you must admit, a very 
    rare fault (if it was common, I'd be able to dup it without problems...  :^)
    
    Key questions for you, Yevgen:
     1) Does the above code cause a failure for you in Tcl 8.3.4 without any extensions? (It might have been due to a bug fixed 
    between 8.3.0 and 8.3.4, if my understanding of what you're using is correct.)
     2) Does the above code cause a failure for you in Tcl 8.4a4 (CVS) without any extensions? (This is optional, but helpful 
    since this is the version I've normally got built with debugging. :^)
     3) The shell you are using; does it include any extensions at all?
     4) Can you try it out with Purify? (Purify is wonderful, or maybe even better than that, but my department let our license 
    expire.  Silly people!)
     5) Bear in mind that when you've got memory corruption or overzealous releasing of object references, the way it can 
    show up in a running Tcl program can be *extremely* odd.  (I should know... :^)
    
    
  2. login: "dkf"
  3. mimetype: "text/plain"
  4. username: "dkf"