Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: eebaac8c7729e04c11af493984750993480318cb
Ticket: 1af8de570511f68630bd54c24579ceef69c63546
TEBC mishandled in [string replace] optimization ?
User & Date: bch on 2016-03-19 00:43:51
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    This:
    proc p1 { val } {
        set ret ""
        for { set i 0 } { $i < $val } { incr i } {
            set ret [format "0%s" $ret]
        }
        return $ret
    }
    
    proc p2 { val } {
        return [string replace [p1 4] 1 1 $val]
    }
    
    puts [ set s [p2 x] ]
    
    
    
    Will cause a fault.
    
    I think I've tracked it to an optimization for inlining a [string replace] (if the string going in is same length as going out, optimized routine), and it appears the _effects_ can be eliminated by adjusting [/artifact/c36c352f54aa5c40?ln=5272] from calling NEXT_INST_F() with 1,1,1, versus 1,0,0. I am not versed in the inner workings of the compiler though, so will leave this for experts and watch with interest what discussions follow.
    
  5. foundin changed to: "abb9522f54"
  6. is_private changed to: "0"
  7. login: "bch"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "0cf17391f69fcfd64bbde2b38bbfbb45c95439e6"
  10. resolution changed to: "None"
  11. severity changed to: "Severe"
  12. status changed to: "Open"
  13. submitter changed to: "bch"
  14. subsystem changed to: "47. Bytecode Compiler"
  15. title changed to: "TEBC mishandled in [string replace] optimization ?"
  16. type changed to: "Bug"