Back in 2003, the format bytecode was changed to allow 32-bit offsets,
but all the stored offsets were still being cast to U16. So for example
only the first char of a 65537 char literal would be output.
This commit removes all the U16 casts.
if (postspace)
*fpc++ = FF_SPACE;
*fpc++ = FF_LITERAL;
- *fpc++ = (U16)arg;
+ *fpc++ = (U32)arg;
}
postspace = FALSE;
if (s <= send)
skipspaces--;
if (skipspaces) {
*fpc++ = FF_SKIP;
- *fpc++ = (U16)skipspaces;
+ *fpc++ = (U32)skipspaces;
}
skipspaces = 0;
if (s <= send)
arg = fpc - linepc + 1;
else
arg = 0;
- *fpc++ = (U16)arg;
+ *fpc++ = (U32)arg;
}
if (s < send) {
linepc = fpc;
arg = (s - base) - 1;
if (arg) {
*fpc++ = FF_LITERAL;
- *fpc++ = (U16)arg;
+ *fpc++ = (U32)arg;
}
base = s - 1;
}
*fpc++ = s - base; /* fieldsize for FETCH */
*fpc++ = FF_DECIMAL;
- *fpc++ = (U16)arg;
+ *fpc++ = (U32)arg;
unchopnum |= ! ischop;
}
else if (*s == '0' && s[1] == '#') { /* Zero padded decimals */
}
*fpc++ = s - base; /* fieldsize for FETCH */
*fpc++ = FF_0DECIMAL;
- *fpc++ = (U16)arg;
+ *fpc++ = (U32)arg;
unchopnum |= ! ischop;
}
else { /* text field */
*fpc++ = ischop ? FF_CHECKCHOP : FF_CHECKNL;
if (prespace)
- *fpc++ = (U16)prespace; /* add SPACE or HALFSPACE */
+ *fpc++ = (U32)prespace; /* add SPACE or HALFSPACE */
*fpc++ = FF_ITEM;
if (ismore)
*fpc++ = FF_MORE;
my $bas_tests = 20;
# number of tests in section 3
-my $bug_tests = 4 + 3 * 3 * 5 * 2 * 3 + 2 + 66 + 3 + 2 + 1 + 1;
+my $bug_tests = 4 + 3 * 3 * 5 * 2 * 3 + 2 + 66 + 4 + 2 + 1 + 1;
# number of tests in section 4
my $hmb_tests = 35;
$orig = "x" x 100 . "\n";
formline $format, $orig, 12345;
is $^A, ("x" x 100) . " 12345\n", "\@* doesn't overflow";
+
+ # make sure it can cope with formats > 64k
+
+ $format = 'x' x 65537;
+ $^A = '';
+ formline $format;
+ # don't use 'is' here, as the diag output will be too long!
+ ok $^A eq $format, ">64K";
}