This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #126991] treat cop_line as unsigned in caller() (since it is)
authorTony Cook <tony@develop-help.com>
Mon, 4 Jan 2016 03:05:32 +0000 (14:05 +1100)
committerTony Cook <tony@develop-help.com>
Wed, 20 Jan 2016 23:55:00 +0000 (10:55 +1100)
pp_ctl.c
t/op/caller.t

index c006ce9..011da56 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1808,7 +1808,7 @@ PP(pp_caller)
                       cx->blk_sub.retop, TRUE);
     if (!lcop)
        lcop = cx->blk_oldcop;
-    mPUSHi((I32)CopLINE(lcop));
+    mPUSHu(CopLINE(lcop));
     if (!has_arg)
        RETURN;
     if (CxTYPE(cx) == CXt_SUB || CxTYPE(cx) == CXt_FORMAT) {
index 6e56d67..80d3a5a 100644 (file)
@@ -5,7 +5,7 @@ BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
     require './test.pl';
-    plan( tests => 95 );
+    plan( tests => 96 );
 }
 
 my @c;
@@ -308,6 +308,11 @@ is eval "s//<<END/e;\nfoo\nEND\n(caller 0)[6]",
  is $w, 1, 'value from (caller 0)[9] (bitmask) works in ${^WARNING_BITS}';
 }
 
+# [perl #126991]
+sub getlineno { (caller)[2] }
+my $line = eval "\n#line 3000000000\ngetlineno();";
+is $line, "3000000000", "check large line numbers are preserved";
+
 # This was fixed with commit d4d03940c58a0177, which fixed bug #78742
 fresh_perl_is <<'END', "__ANON__::doof\n", {},
 package foo;