summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sv.c12
-rw-r--r--t/op/64bit.t25
2 files changed, 31 insertions, 6 deletions
diff --git a/sv.c b/sv.c
index 2257516fae..1b15240da4 100644
--- a/sv.c
+++ b/sv.c
@@ -4925,7 +4925,11 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
goto integer;
case 'D':
+#ifdef IV_IS_QUAD
+ /* nothing */
+#else
intsize = 'l';
+#endif
/* FALL THROUGH */
case 'd':
case 'i':
@@ -4973,7 +4977,11 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
goto integer;
case 'U':
+#ifdef IV_IS_QUAD
+ /* nothing */
+#else
intsize = 'l';
+#endif
/* FALL THROUGH */
case 'u':
base = 10;
@@ -4984,7 +4992,11 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
goto uns_integer;
case 'O':
+#ifdef IV_IS_QUAD
+ /* nothing */
+#else
intsize = 'l';
+#endif
/* FALL THROUGH */
case 'o':
base = 8;
diff --git a/t/op/64bit.t b/t/op/64bit.t
index c8da1cbcdb..f49b5e47f6 100644
--- a/t/op/64bit.t
+++ b/t/op/64bit.t
@@ -11,7 +11,7 @@ BEGIN {
# Nota bene: bit operations are not 64-bit clean. See the beginning
# of pp.c and the explanation next to IBW/UBW.
-print "1..27\n";
+print "1..30\n";
my $q = 12345678901;
my $r = 23456789012;
@@ -113,22 +113,35 @@ print "not " unless $x == $q && $x eq $q;
print "ok 22\n";
+$x = sprintf("%D", $q);
+print "not " unless $x == $q && $x eq $q;
+print "ok 23\n";
+
+$x = sprintf("%U", $q);
+print "not " unless $x == $q && $x eq $q;
+print "ok 24\n";
+
+$x = sprintf("%O", $q);
+print "not " unless oct($x) == $q;
+print "ok 25\n";
+
+
$x = $q + $r;
print "not " unless $x == 35802467913;
-print "ok 23\n";
+print "ok 26\n";
$x = $q - $r;
print "not " unless $x == -11111110111;
-print "ok 24\n";
+print "ok 27\n";
$x = $q * $r;
print "not " unless $x == 289589985190657035812;
-print "ok 25\n";
+print "ok 28\n";
$x /= $r;
print "not " unless $x == $q;
-print "ok 26\n";
+print "ok 29\n";
$x = 98765432109 % 12345678901;
print "not " unless $x == 901;
-print "ok 27\n";
+print "ok 30\n";