Ticket #1482 (closed bug: fixed)

Opened 4 years ago

Last modified 4 years ago

index op failure

Reported by: pmichaud Owned by: coke
Priority: major Milestone:
Component: core Version: 2.1.0
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

The index op seems to fail when certain unicode strings are used:

$ cat z.pir
.sub 'main' :main
    $S0 = unicode:"bubuc"
    $S1 = unicode:"buc"

    $I0 = index $S0, $S1, 0
    say $I0
.end

$ ./parrot z.pir
-1
$ 

Removing the "unicode:" from $S1 one above also produces the same (incorrect) result.

Pm

Change History

Changed 4 years ago by coke

  • owner set to coke

Changed 4 years ago by coke

  • status changed from new to closed
  • resolution set to fixed

Fixed in r44496;

The mixed_cs_index function had two iterators, one for the source string and one for the search string; if a partial match was found, the source string's iterator was not properly reset, but instead continued from the point of the invalid match.

Added test to avoid regression.

Note: See TracTickets for help on using tickets.