Tcl Source Code

View Ticket
Login
Ticket UUID: 1ae976e237cf0a4d040de9435ce0554a8c8c7606
Title: Compiled [clock clicks -mi] returns microseconds instead of an ambiguous option error
Type: Bug Created on: 2026-10-12 20:32:40
Submitter: serhiy.storchaka Assigned to: jan.nijtmans
Subsystem: 47. Bytecode Compiler Severity: Minor
Priority: 5 Medium Last modified: 2026-10-13 12:15:42
Status: Closed Closed by: jan.nijtmans
Resolution: Fixed Closed on: 2026-10-13 12:15:42
Version: 9.1.0
Description:

clock clicks -mi is an error ("ambiguous option "-mi": must be -milliseconds or -microseconds"), but in compiled code 9.1 accepts it and returns microseconds:

proc p {} {clock clicks -mi}
p

9.0 compiles the option only if it is at least 4 characters long, so it gives the error in both cases. [507b920e63] (TIP 720) replaced that check with IS_TOKEN_PREFIX(tokenPtr, 3, ...).

Proposed fix in branch compile-clock-clicks-ambiguous: require 4 characters again. Tests clock-33.7.1 and clock-33.7.2.

User Comments:
jan.nijtmans added on 2026-10-13 12:15:42:

Fixed in [88c6ad4c756c8244|trunk]

Many thanks!