Skip to content
Tcl Source Code Artifact [509841d50b]
Login

Artifact [509841d50b]

Artifact 509841d50bc0dc69ee4c7b3ca3b7319b840c12eb:

Ticket change [509841d50b] - Ticket [505048ffffffffff|505048ffff] <i>impossible occurs!</i> status still Open with 4 other changes by mistachkin on 2003-05-10 20:10:15.
D 2003-05-10T20:10:15
J icomment Logged\sIn:\sYES\s\nuser_id=113501\n\nAfter\sfurther\sresearch,\sI\shave\suncovered\sthe\sfollowing\s\ninformation:\n\nIn\sfile\sregexec.c\son\sline\s#281,\sthere\sis\sthe\sfollowing\s\ncode:\n\nclose\s=\sshortest(v,\ss,\sv->start,\sv->start,\sv->stop,\s\n&cold,\s(int\s*)NULL);\n\nThis\scall\sis\snot\sproducing\sthe\scorrect\sresult\sfor\s\nthis\s"buggy"\sregexp.\s\sI\scame\sto\sthis\sconclusion\safter\sI\s\nwas\sable\sto\sobtain\sthe\scorrect\sresult\sby\smanually\ssetting\s\nthe\sloop\sstart\svariable\sbegin\sto\sthe\svalue\sof\sv->start.\s\s\nAs\swe\scan\ssee\shere,\s"begin"\sgets\sit's\sinitial\svalue\sfrom\s\nthe\svariable\s"open",\swhich\sgets\sit's\sinitial\svalue\sfrom\sthe\s\nvariable\s"cold",\swhich\sis\sset\sby\sfunction\s"shortest"\sprior\s\nto\sthe\sloop.\s\sThe\sfollowing\sattempts\sto\sillustrate\sthe\s\nflow\sof\sthis\svery\simportant\svalue:\n\ncold\s=\sNULL;\nclose\s=\sshortest(v,\ss,\sv->start,\sv->start,\sv->stop,\s\n&cold,\s(int\s*)NULL);\n\n<more\scode\shere>\n\nopen\s=\scold;\ncold\s=\sNULL;\n\n<more\scode\shere>\n\nfor\s(begin\s=\sopen;\sbegin\s<=\sclose;\sbegin++)\s{\n\s\s<more\scode\shere>\n\s\s<this\sloop\sis\sextremely\ssensitive\sto\sthe\sstarting\svalue\s\nof\s"begin">\n}\n\nFurther\sanalysis\sreveals\sthe\sreason\swhy\sthe\s\nvariable\s"cold"\sis\sgetting\san\sinvalid\svalue\s(off\sby\s\none\s"character",\swhich\sis\sactually\s2\sbytes).\s\s\n\nThis\sis\sdue\sto\sfunction\s"shortest"\scalling\s\nfunction\s"lastcold",\swhich\siterates\sthrough\sthe\s"d-\n>ssets"\sarray\slooking\sfor\sa\sNOPROGRESS\sflag.\s\s\n\nI\sbelieve\sthis\sis\sthe\sroot\scause\sof\sthe\sproblem,\sthe\s\nNOPROGRESS\sflag\sis\sbeing\sset\son\sd->sset[2]\sincorrectly,\s\nspecifically\sin\sthe\s"miss"\sfunction\scalled\s(quite\sa\sfew\s\ntimes)\sby:\n\nfind\s-->\sshortest\s-->\smiss\n\nThe\sinteresting\sthing\sabout\sthis\sis\sthat\sit\sappears\sto\sbe\s\na\svery\sfancy\soff-by-one\serror.\n\nIt\smay\sbe\sworthwhile\sto\sfurther\sanalyze\sthe\sdifferences\s\nbetween\s"{^blah}"\sand\s"{\\Ablah}"\sto\sunderstand\swhy\sthe\s\nNOPROGRESS\sflag\sis\sbeing\sset\sincorrectly.\n\n
J login mistachkin
J mimetype text/plain
J username mistachkin
K 505048ffffffffffffffffffffffffffffffffff
U mistachkin
Z c026ad9c10c5e9c147b6721ebacedef6