Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 427b781217390cfdf29b9c78bba3c589c33277da
Ticket: 613117ffffffffffffffffffffffffffffffffff
Memory corruption (in expr?)
User & Date: pspjuth on 2002-09-24 04:33:47
Changes

  1. icomment:
    Logged In: YES 
    user_id=98900
    
    Looks like a case of object shimmering in
    shared literals.
    
    I 
    extended the script with some debug info to
    see what's going on. 
    ([info objtype] is something
    in my debug version that prints the 
    internal object
    type):
    
    proc bug {} { 
        grid columnconfig . 0 -
    minsize 10 
    } 
    
    proc main {} {
        puts "Before bug: [info objtype 
    10]"
        bug 
        puts "After bug: [info objtype 10]"
        puts [expr 
    {double(10)}] 
        puts "After double: [info objtype 10]"
        puts [expr 10] 
    
        puts "After expr: [info objtype 10]"
    }
    
    proc main2 {} {
        puts 
    "\nWithout bug: [info objtype 11]"
        puts [expr {double(11)}] 
        puts 
    "After double: [info objtype 11]"
        puts [expr 11] 
        puts "After expr: 
    [info objtype 11]"
    }
    
    main
    main2
    
    
    Before bug: 
    int
    After bug: pixel
    10.0
    After double: wideInt
    10
    After 
    expr: wideInt
    
    Without bug: int
    11.0
    After double: 
    int
    11
    After expr: int
    
    
    Grid turns the literal into a "pixel" 
    object and
    then it seems double() has a preference for 
    "wideInt"
    when faced with something that isn't an "int",
    which 
    may or may not be considered a bug.
    It sure is a bug though that wide 
    integers don't
    work properly on your platform, but this shows 
    why
    it triggers the bug in that strange case.
    
    Does this also 
    trigger the bug?
    puts [expr wide(10)]
    
    
    
  2. login: "pspjuth"
  3. mimetype: "text/plain"
  4. username: "pspjuth"