diff --git a/src/asm/parser.y b/src/asm/parser.y index 275e4585..f5ee2437 100644 --- a/src/asm/parser.y +++ b/src/asm/parser.y @@ -1623,7 +1623,7 @@ string_literal: | OP_STRSLICE LPAREN string COMMA iconst RPAREN { size_t len = strlenUTF8($3, false); uint32_t start = adjustNegativeIndex($5, len, "STRSLICE"); - $$ = strsliceUTF8($3, start, len - 1); + $$ = strsliceUTF8($3, start, len); } | OP_STRSUB LPAREN string COMMA iconst COMMA uconst RPAREN { size_t len = strlenUTF8($3, false); diff --git a/test/asm/strslice-strsub.out b/test/asm/strslice-strsub.out index 2c814f42..d0e95f19 100644 --- a/test/asm/strslice-strsub.out +++ b/test/asm/strslice-strsub.out @@ -5,10 +5,10 @@ STRSLICE("ABC",-3,-2): A STRSLICE("ABC",-2,-1): B STRSLICE("ABC",-1,-0): STRSLICE("ABC",-1,3): C -STRSLICE("ABC",1): B -STRSLICE("ABC",-2): B +STRSLICE("ABC",1): BC +STRSLICE("ABC",-2): BC STRSLICE("ABC",4): -STRSLICE("ABC",-4): AB +STRSLICE("ABC",-4): ABC STRSLICE("ABC",0,2): AB STRSLICE("ABC",1,3): BC STRSLICE("ABC",1,31): BC