Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 30ee656dc1d30039a1b8f008b32f2259b72199da
Ticket: 218629ffffffffffffffffffffffffffffffffff
Integer literal is converted to double
User & Date: nobody on 2000-10-26 01:03:20
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 1516 Bug
    Version: 8.1b2
    SubmitDate: '1999-03-18'
    LastModified: '1999-03-25'
    Severity: CRIT
    Status: Released
    Submitter: pat
    ChangedBy: stanton
    RelatedBugIDs: 1606
    OS: Other
    OSVersion: FreeBSD 2.2.7
    Machine: NA
    FixedDate: '1999-03-24'
    FixedInVersion: 8.1b3
    ClosedDate: '2000-10-25'
    
    
    Name:
    
    Mark Diekhans
    
    
    
    CVS:
    
    updated mar 16, 1999, ~18:00 PST
    
    
    
    Extensions:
    
    TclX
    
    
    
    ReproducibleScript:
    
        The enclosed script runs a subset of the TclX tests that reproduces
    
        the problem.  Use the trunk of the TclX tree and build with 8.1b2.
    
        cd to tcl/tests and place the enclosed script there.  Do a:
    
        
    
           ../unix/runtest bug.tcl
    
        
    
        There are two ways to reproduce it, controlled by editing an `if'
    
        command;
    
        A simple case that produces the failure ones and a complex case that
    
        causes
    
        it to happen several times.
    
        
    
        By turning on cmdtrace, it appears that the error always comes from
    
        the unknown handler.  In order to handle the TclX library format, the
    
        auto_load_index is replaced with a slightly modified version.  It
    
        appears
    
        that this has something to do with redefining a proc.
    
        
    
        In 8.1b1, I spent a some time trying to isolate this and got far enough
    
        to
    
        be convinced that is was a problem in Tcl core, not some bogus thing
    
        TclX
    
        was doing.
    
        
    
        # This causes errorInfo to be printed on test failure.
    
        set TEST_ERROR_INFO 1
    
        
    
        # This will product a trace of all executed commands.
    
        #cmdtrace on [open cmd.log w]
    
        
    
        proc runtest f {
    
            if [catch {uplevel #0 source $f} msg] {
    
                puts stderr "$f failed: $msg"
    
                puts stderr $::errorInfo
    
            }
    
        }
    
        
    
        if {1} {
    
            # This block causes several integer literals to be 
    
            # converted to doubles.
    
            runtest showproc.test
    
            runtest signal.test
    
            runtest socket.test
    
            runtest string.test
    
            runtest stringfil.test
    
            runtest sync.test
    
            runtest tcllib.test
    
        } else {
    
            # This block causes a single integer literal to be
    
            # converted to a double.
    
            runtest signal.test
    
            runtest tcllib.test
    
        }
    
        
    
        
    
    
    
    
    
    
    
    ObservedBehavior:
    
        The code:
    
            for {set i [expr {[llength $auto_path] - 1}]} {$i >= 0} {incr i -1}
    
        {
    
        set dir [lindex $auto_path $i]
    
        
    
        ends up lindex-ing with a double value (1.0, 2.0, etc).  As I recall,
    
        this
    
        is because a Tcl_GetDoubleFromObj appears to convert the literal `1' in
    
        the
    
        expr to a double.
    
        
    
        
    
    
    
    
    
    
    
    This needs to be verified and fixed.  03/23/1999 19:11 - surles -
    
    
    03/24/1999 18:12 - stanton -
    
    The simplest test case is:
    
    
    proc foo {} {
    
        set x 1
    
        format %f $x
    
        expr {$x + 2}}
    
    }
    
    foo
    
    
    Returns "3.0" instead of "3".
    
    
    The problem is that the expression code relies on the type of the internal rep
    
    to decide how to format the result instead of checking to see if the inputs really
    
    look like integers.
    
    
    
    
  4. foundin changed to: "obsolete: 8.1b2"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "69. Other"
  10. title changed to: "Integer literal is converted to double"
  11. type changed to: "Bug"