Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2016-10-14
19:29
[eb6b68c1a9] Simple fix for [string replace] error demonstrated by new test. check-in: 699a33324b user: dgp tags: trunk
19:29 • Closed ticket [eb6b68c1a9]: Broken case in compiled string replace plus 6 ... artifact: c6856f584e user: dgp
19:28
[eb6b68c1a9] Simple fix for [string replace] error demonstrated by new test. check-in: f58d30ec32 user: dgp tags: core-8-6-branch
09:05 • Ticket [eb6b68c1a9] Broken case in compiled string replace status still Op... artifact: 6ec4fa44e8 user: dkf
2016-10-13
14:01 • Ticket [eb6b68c1a9]: 4 changes artifact: ffdb138879 user: dgp
13:49 • New ticket [eb6b68c1a9]. artifact: 15e968b958 user: dgp

Broken case in compiled [string replace]

Closed / Fixedeb6b68c1a9f3d07e0bceeb2a3b47a5c4d343d096Created 10 years agoUpdated 10 years ago
Descriptionplain2016-10-13 13:49:26
New test demonstrating failure:

test stringComp-14.5 {} {
    apply {{} {string replace [string repeat a\u00fe 5] 3 end {} }}
} a\u00fea
Referenced by2
  • 699a33324b[eb6b68c1a9] Simple fix for [string replace] error demonstrated by new test. check-in2016-10-14 19:29:52
  • f58d30ec32[eb6b68c1a9] Simple fix for [string replace] error demonstrated by new test. check-in2016-10-14 19:28:46
dgpplain2016-10-13 14:01:13
The stanza of code:

http://core.tcl.tk/tcl/artifact/57cea04b21f64a97?ln=5731-5736

is until now untested.

The stanza is unreliable because it makes use of
Tcl_SetObjLength() without accounting for that
routine's bizarre dual-mode where it behaves
functionally differently whether or not its
(Tcl_Obj *) argument points to a value with
an existing string rep or is pure unicode.
It can act on bytes or on chars, but for proper
functioning here, it would need to be forced
to reliably operate on chars.

Simplest fix would be just to remove this stanza
and forgo the attempted optimization in  the
(rare?) circumstance that lack of sharing permits it.
dkfwiki2016-10-14 09:05:42

Yet another gnarly nasty. Seems a reasonable way of dealing with it.

dgp Closed ticket [eb6b68c1a9]. [History diff]2016-10-14 19:29:07
Log in (anonymous is fine) to add a comment.