Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f3041894dec819aec2390b1385d3b7f151943cd050db36e3603a83a8c98dd1f2
Ticket: 8dd2807066d7cc4d8604164f39b7f0d65c0dc321
bug in single-argument 'max' with bignums
User & Date: apnadkarni on 2025-11-11 09:57:03
Changes

  1. closedate changed to: "2460990.9146189"
  2. closer changed to: "apnadkarni"
  3. icomment:
    Jan,
    
    - The bug is in the function `TclCompareTwoNumbers` which does not handle the case of the two arguments valuePtr and value2Ptr being equal.
    - Your commit fixes this at the call site in `ExprMaxMinFunc` by not calling `TclCompareTwoNumbers` in the case of a single argument.
    - This leaves the actual bug in `TclCompareTwoNumbers` in place meaning any existing or future caller will be subject to the same failure.
    
    That is not an appropriate fix. If you insist on keeping the use of `Tcl_TakeBignumFromObj` and avoid `Tcl_GetBignumFromObj` for whatever reason, at the very least you should pick up Sergey's changes to `Tcl_TakeBignumFromObj` as well.
    
    FWIW, I still prefer to simply replace Take with Get instead and not require any changes at the call site in `ExprMaxMinFunc`. The Take form, even with Sergey's changes, does not buy you anything. A new bignum has to be created in either case.
    
  4. login: "apnadkarni"
  5. mimetype: "text/x-markdown"