In perl.git, the branch maint-5.22 has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/bc2d3ae58d16ea4934b4e2de00aa4e96cac33e93?hp=0d84e962b84dbf431832b66ebef7b3ad488966e0>

- Log -----------------------------------------------------------------
commit bc2d3ae58d16ea4934b4e2de00aa4e96cac33e93
Author: Jarkko Hietaniemi <[email protected]>
Date:   Tue Mar 15 19:23:59 2016 -0400

    Backport of a4570f51dba109184d92dcbb0612242d942856fc

M       embed.fnc
M       embed.h
M       proto.h

commit 7656c3f4dc6b352ad0b828bb137044a44694e083
Author: Tony Cook <[email protected]>
Date:   Tue Mar 1 11:35:21 2016 +1100

    [perl #127533] only test semctl() if we have everything needed to use it
    
    In a FreeBSD jail, the semctl() entry point might exist, but can be
    disabled by policy, when it is disabled, the Configure code that
    tests for the different structures that can be supplied to semctl()
    fail.
    
    The code that implements semctl() for perl treats semctl() as
    unimplemented if neither structure is available, so avoid testing
    semctl() if the structures couldn't be detected.
    
    (cherry picked from commit 9234e5bdb7cb62dbf09ea4fd4ae5f3831cf78890)

M       t/io/semctl.t

commit 9a427118a27dce49b50e2c7d619b9f5aa048101d
Author: Andreas Koenig <[email protected]>
Date:   Sun Jan 3 08:40:33 2016 +0100

    Remove nm from libswanted
    
    Nm stood for "New Math" library in the context of 1994. 2014 a conflicting
    library libnm appeared that has a network manager context.
    
    (cherry picked from commit 4732711e2548b6d734ca831d65dbcf501a89774e)

M       Configure

commit 11c0dec80e86a2efeef002853ab7f0e12199f729
Author: Jarkko Hietaniemi <[email protected]>
Date:   Sun Nov 15 19:45:06 2015 -0500

    Configure: gcc 5 exists.
    
    (cherry picked from commit 0632167b5a653661f48c9e38df6aa76b544d4079)

M       Configure

commit 9e34313fa1012364a873b69e7dfb9728d3877fc9
Author: Jarkko Hietaniemi <[email protected]>
Date:   Tue Mar 22 19:43:21 2016 -0400

    [perl #127764] Perl with '-Dusecbacktrace' doesn't compile on darwin
    
    Fix a thinko in 22ff3130.
    
    (cherry picked from commit 99315af872aaf23d9620b68b29cdc34181bf06c7)

M       util.c

commit 68905cdc1bd8e8f2a381a1e31a8fee89e3bdf15d
Author: Jarkko Hietaniemi <[email protected]>
Date:   Thu Dec 10 06:59:03 2015 -0500

    hexfp: all ppc/powerpc-ld linux tailbits difference in exp(1)
    
    (not just linux-ppc64-ld)
    
    Not a regression from 5.22.0.
    
    (cherry picked from commit 35ff3d7deb0d8004539a00980bb69ece71275982)

M       t/op/sprintf2.t

commit 79e8a02dc08516d820edf19258f9cc87f57ede83
Author: Jarkko Hietaniemi <[email protected]>
Date:   Sun Mar 27 11:11:18 2016 -0400

    Move the zeroing back before the dladdr() call.
    
    (cherry picked from commit 4d00a3198aa6950e874328ec431d15c821382cce)

M       util.c

commit 295c3a23f338878d1944fb5580e87c8576c9e239
Author: Vladimir Timofeev <[email protected]>
Date:   Fri Mar 25 08:41:25 2016 -0400

    [perl #127773: Assertion failure in perl built with Dusecbacktrace]
    
    (cherry picked from commit 70ead873d4b864ca127d4f75aa654724264ff91b)

M       util.c

commit 5ea079b1d3a2ba7e2f02b5e72e9976101a3c1d86
Author: Aaron Crane <[email protected]>
Date:   Tue Apr 5 08:08:18 2016 +0100

    Remove unwarranted assertion in Perl_newATTRSUB_x()
    
    RT #126845: if a stub subroutine definition with a prototype has been seen,
    then any subsequent stub (or definition) of the same subroutine with an
    attribute was causing an assertion failure because of a null pointer.
    
    This assertion was added in 2eaf799e74b14dc77b90d5484a3fd4ceac12b46a, which
    itself would already have triggered this assertion failure, even though all
    subsequent uses of the pointer in question were guarded with non-null
    conditions. So merely deleting the assertion is the right thing.
    
    (cherry picked from commit a934a4a7d4fa99d522e169b921286755a0f8d248)

M       op.c
M       t/op/sub.t
-----------------------------------------------------------------------

Summary of changes:
 Configure       |  8 ++++----
 embed.fnc       | 10 +++++++++
 embed.h         | 14 ++++++++-----
 op.c            |  1 -
 proto.h         | 64 +++++++++++++++++++++++++++++----------------------------
 t/io/semctl.t   |  2 ++
 t/op/sprintf2.t | 16 +++++++++------
 t/op/sub.t      |  9 +++++++-
 util.c          | 13 ++++++------
 9 files changed, 83 insertions(+), 54 deletions(-)

diff --git a/Configure b/Configure
index d5ae749..5f5f279 100755
--- a/Configure
+++ b/Configure
@@ -1455,7 +1455,7 @@ libswanted_uselargefiles=''
 : set usesocks on the Configure command line to enable socks.
 : List of libraries we want.
 : If anyone needs extra -lxxx, put those in a hint file.
-libswanted="cl pthread socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld"
+libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
 : We probably want to search /usr/shlib before most other libraries.
 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
@@ -23010,7 +23010,7 @@ fi
 
 : add -D_FORTIFY_SOURCE if feasible and not already there
 case "$gccversion" in
-4.*)   case "$optimize$ccflags" in
+[45].*)        case "$optimize$ccflags" in
        *-O*)   case "$ccflags$cppsymbols" in
                *_FORTIFY_SOURCE=*) # Don't add it again.
                        echo "You seem to have -D_FORTIFY_SOURCE already, not 
adding it." >&4
@@ -23020,11 +23020,11 @@ case "$gccversion" in
                        ;;
                esac
                ;;
-       *)      echo "You have gcc 4.* but not optimizing, not adding 
-D_FORTIFY_SOURCE." >&4
+       *)      echo "You have gcc 4.* or later but not optimizing, not adding 
-D_FORTIFY_SOURCE." >&4
                ;;
        esac
        ;;
-*)     echo "You seem not to have gcc 4.*, not adding -D_FORTIFY_SOURCE." >&4
+*)     echo "You seem not to have gcc 4.* or later, not adding 
-D_FORTIFY_SOURCE." >&4
        ;;
 esac
 
diff --git a/embed.fnc b/embed.fnc
index 5302779..0147e4b 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -230,7 +230,9 @@ Apd |void   |av_push        |NN AV *av|NN SV *val
 EXp    |void   |av_reify       |NN AV *av
 ApdR   |SV*    |av_shift       |NN AV *av
 Apd    |SV**   |av_store       |NN AV *av|SSize_t key|NULLOK SV *val
+#ifndef PERL_NO_INLINE_FUNCTIONS
 AidR   |SSize_t|av_top_index   |NN AV *av
+#endif
 AmpdR  |SSize_t|av_tindex      |NN AV *av
 Apd    |void   |av_undef       |NN AV *av
 ApdoxM |SV**   |av_create_and_unshift_one|NN AV **const avp|NN SV *const val
@@ -653,7 +655,9 @@ pR  |OP*    |invert         |NULLOK OP* cmd
 ApR    |I32    |is_lvalue_sub
 : Used in cop.h
 XopR   |I32    |was_lvalue_sub
+#ifndef PERL_NO_INLINE_FUNCTIONS
 AiMRn  |STRLEN |_is_utf8_char_slow|NN const U8 *s|NN const U8 *e
+#endif
 ADMpPR |U32    |to_uni_upper_lc|U32 c
 ADMpPR |U32    |to_uni_title_lc|U32 c
 ADMpPR |U32    |to_uni_lower_lc|U32 c
@@ -1449,7 +1453,9 @@ Apd       |void   |sv_magic       |NN SV *const sv|NULLOK 
SV *const obj|const int how \
 Apd    |MAGIC *|sv_magicext    |NN SV *const sv|NULLOK SV *const obj|const int 
how \
                                |NULLOK const MGVTBL *const vtbl|NULLOK const 
char *const name \
                                |const I32 namlen
+#ifndef PERL_NO_INLINE_FUNCTIONS
 Ein    |bool   |sv_only_taint_gmagic|NN SV *sv
+#endif
 : exported for re.pm
 EXp    |MAGIC *|sv_magicext_mglob|NN SV *sv
 ApdbamR        |SV*    |sv_mortalcopy  |NULLOK SV *const oldsv
@@ -1693,8 +1699,10 @@ Am       |I32    |whichsig       |NN const char* sig
 Ap     |I32    |whichsig_sv    |NN SV* sigsv
 Ap     |I32    |whichsig_pv    |NN const char* sig
 Ap     |I32    |whichsig_pvn   |NN const char* sig|STRLEN len
+#ifndef PERL_NO_INLINE_FUNCTIONS
 : used to check for NULs in pathnames and other names
 AiR    |bool   |is_safe_syscall|NN const char *pv|STRLEN len|NN const char 
*what|NN const char *op_name
+#endif
 #ifdef PERL_CORE
 inR    |bool   |should_warn_nl|NN const char *pv
 #endif
@@ -2511,7 +2519,9 @@ sRM       |U8*    |swash_scan_list_line|NN U8* l|NN U8* 
const lend|NN UV* min \
                |NN const U8* const typestr
 #endif
 
+#ifndef PERL_NO_INLINE_FUNCTIONS
 AiMn   |void   |append_utf8_from_native_byte|const U8 byte|NN U8** dest
+#endif
 
 Apd    |void   |sv_setsv_flags |NN SV *dstr|NULLOK SV *sstr|const I32 flags
 Apd    |void   |sv_catpvn_flags|NN SV *const dstr|NN const char *sstr|const 
STRLEN len \
diff --git a/embed.h b/embed.h
index 687819c..8598ac8 100644
--- a/embed.h
+++ b/embed.h
@@ -32,7 +32,6 @@
 #define _is_uni_perl_idcont(a) Perl__is_uni_perl_idcont(aTHX_ a)
 #define _is_uni_perl_idstart(a)        Perl__is_uni_perl_idstart(aTHX_ a)
 #define _is_utf8_FOO(a,b)      Perl__is_utf8_FOO(aTHX_ a,b)
-#define _is_utf8_char_slow     S__is_utf8_char_slow
 #define _is_utf8_idcont(a)     Perl__is_utf8_idcont(aTHX_ a)
 #define _is_utf8_idstart(a)    Perl__is_utf8_idstart(aTHX_ a)
 #define _is_utf8_mark(a)       Perl__is_utf8_mark(aTHX_ a)
@@ -47,7 +46,6 @@
 #define _to_utf8_upper_flags(a,b,c,d)  Perl__to_utf8_upper_flags(aTHX_ a,b,c,d)
 #define amagic_call(a,b,c,d)   Perl_amagic_call(aTHX_ a,b,c,d)
 #define amagic_deref_call(a,b) Perl_amagic_deref_call(aTHX_ a,b)
-#define append_utf8_from_native_byte   S_append_utf8_from_native_byte
 #define apply_attrs_string(a,b,c,d)    Perl_apply_attrs_string(aTHX_ a,b,c,d)
 #define atfork_lock            Perl_atfork_lock
 #define atfork_unlock          Perl_atfork_unlock
@@ -63,7 +61,6 @@
 #define av_push(a,b)           Perl_av_push(aTHX_ a,b)
 #define av_shift(a)            Perl_av_shift(aTHX_ a)
 #define av_store(a,b,c)                Perl_av_store(aTHX_ a,b,c)
-#define av_top_index(a)                S_av_top_index(aTHX_ a)
 #define av_undef(a)            Perl_av_undef(aTHX_ a)
 #define av_unshift(a,b)                Perl_av_unshift(aTHX_ a,b)
 #define block_end(a,b)         Perl_block_end(aTHX_ a,b)
@@ -246,7 +243,6 @@
 #define isIDFIRST_lazy(a)      Perl_isIDFIRST_lazy(aTHX_ a)
 #define is_invariant_string    Perl_is_invariant_string
 #define is_lvalue_sub()                Perl_is_lvalue_sub(aTHX)
-#define is_safe_syscall(a,b,c,d)       S_is_safe_syscall(aTHX_ a,b,c,d)
 #define is_uni_alnum(a)                Perl_is_uni_alnum(aTHX_ a)
 #define is_uni_alnum_lc(a)     Perl_is_uni_alnum_lc(aTHX_ a)
 #define is_uni_alnumc(a)       Perl_is_uni_alnumc(aTHX_ a)
@@ -775,6 +771,12 @@
 #define my_pclose(a)           Perl_my_pclose(aTHX_ a)
 #define my_popen(a,b)          Perl_my_popen(aTHX_ a,b)
 #endif
+#if !defined(PERL_NO_INLINE_FUNCTIONS)
+#define _is_utf8_char_slow     S__is_utf8_char_slow
+#define append_utf8_from_native_byte   S_append_utf8_from_native_byte
+#define av_top_index(a)                S_av_top_index(aTHX_ a)
+#define is_safe_syscall(a,b,c,d)       S_is_safe_syscall(aTHX_ a,b,c,d)
+#endif
 #if (!defined(HAS_MEMCPY) && !defined(HAS_BCOPY)) || (!defined(HAS_MEMMOVE) && 
!defined(HAS_SAFE_MEMCPY) && !defined(HAS_SAFE_BCOPY))
 #define my_bcopy               Perl_my_bcopy
 #endif
@@ -916,7 +918,6 @@
 #define reg_temp_copy(a,b)     Perl_reg_temp_copy(aTHX_ a,b)
 #define report_uninit(a)       Perl_report_uninit(aTHX_ a)
 #define sv_magicext_mglob(a)   Perl_sv_magicext_mglob(aTHX_ a)
-#define sv_only_taint_gmagic   S_sv_only_taint_gmagic
 #define validate_proto(a,b,c)  Perl_validate_proto(aTHX_ a,b,c)
 #define vivify_defelem(a)      Perl_vivify_defelem(aTHX_ a)
 #define yylex()                        Perl_yylex(aTHX)
@@ -929,6 +930,9 @@
 #define invlist_trim           S_invlist_trim
 #    endif
 #  endif
+#  if !defined(PERL_NO_INLINE_FUNCTIONS)
+#define sv_only_taint_gmagic   S_sv_only_taint_gmagic
+#  endif
 #  if defined(DEBUGGING)
 #    if defined(PERL_IN_REGCOMP_C)
 #define dump_trie(a,b,c,d)     S_dump_trie(aTHX_ a,b,c,d)
diff --git a/op.c b/op.c
index 3377d08..68ac57c 100644
--- a/op.c
+++ b/op.c
@@ -8571,7 +8571,6 @@ Perl_newATTRSUB_x(pTHX_ I32 floor, OP *o, OP *proto, OP 
*attrs,
            S_op_const_sv(aTHX_ start, PL_compcv, cBOOL(CvCLONE(PL_compcv)));
 
     if (SvPOK(gv) || (SvROK(gv) && SvTYPE(SvRV(gv)) != SVt_PVCV)) {
-       assert (block);
        cv_ckproto_len_flags((const CV *)gv,
                             o ? (const GV *)cSVOPo->op_sv : NULL, ps,
                             ps_len, ps_utf8|CV_CKPROTO_CURSTASH);
diff --git a/proto.h b/proto.h
index 0a33758..db14824 100644
--- a/proto.h
+++ b/proto.h
@@ -61,13 +61,6 @@ PERL_CALLCONV bool   Perl__is_utf8_FOO(pTHX_ const U8 
classnum, const U8 *p)
 #define PERL_ARGS_ASSERT__IS_UTF8_FOO  \
        assert(p)
 
-PERL_STATIC_INLINE STRLEN      S__is_utf8_char_slow(const U8 *s, const U8 *e)
-                       __attribute__warn_unused_result__
-                       __attribute__nonnull__(1)
-                       __attribute__nonnull__(2);
-#define PERL_ARGS_ASSERT__IS_UTF8_CHAR_SLOW    \
-       assert(s); assert(e)
-
 PERL_CALLCONV bool     Perl__is_utf8_idcont(pTHX_ const U8 *p)
                        __attribute__warn_unused_result__
                        __attribute__nonnull__(pTHX_1);
@@ -158,11 +151,6 @@ PERL_CALLCONV SV * Perl_amagic_deref_call(pTHX_ SV *ref, 
int method)
        assert(ref)
 
 PERL_CALLCONV bool     Perl_amagic_is_enabled(pTHX_ int method);
-PERL_STATIC_INLINE void        S_append_utf8_from_native_byte(const U8 byte, 
U8** dest)
-                       __attribute__nonnull__(2);
-#define PERL_ARGS_ASSERT_APPEND_UTF8_FROM_NATIVE_BYTE  \
-       assert(dest)
-
 PERL_CALLCONV I32      Perl_apply(pTHX_ I32 type, SV** mark, SV** sp)
                        __attribute__nonnull__(pTHX_2)
                        __attribute__nonnull__(pTHX_3);
@@ -282,12 +270,6 @@ PERL_CALLCONV SV** Perl_av_store(pTHX_ AV *av, SSize_t 
key, SV *val)
                        __attribute__warn_unused_result__
                        __attribute__nonnull__(pTHX_1); */
 
-PERL_STATIC_INLINE SSize_t     S_av_top_index(pTHX_ AV *av)
-                       __attribute__warn_unused_result__
-                       __attribute__nonnull__(pTHX_1);
-#define PERL_ARGS_ASSERT_AV_TOP_INDEX  \
-       assert(av)
-
 PERL_CALLCONV void     Perl_av_undef(pTHX_ AV *av)
                        __attribute__nonnull__(pTHX_1);
 #define PERL_ARGS_ASSERT_AV_UNDEF      \
@@ -1880,14 +1862,6 @@ PERL_CALLCONV bool       Perl_is_invariant_string(const 
U8 *s, STRLEN len)
 PERL_CALLCONV I32      Perl_is_lvalue_sub(pTHX)
                        __attribute__warn_unused_result__;
 
-PERL_STATIC_INLINE bool        S_is_safe_syscall(pTHX_ const char *pv, STRLEN 
len, const char *what, const char *op_name)
-                       __attribute__warn_unused_result__
-                       __attribute__nonnull__(pTHX_1)
-                       __attribute__nonnull__(pTHX_3)
-                       __attribute__nonnull__(pTHX_4);
-#define PERL_ARGS_ASSERT_IS_SAFE_SYSCALL       \
-       assert(pv); assert(what); assert(op_name)
-
 PERL_CALLCONV bool     Perl_is_uni_alnum(pTHX_ UV c)
                        __attribute__deprecated__
                        __attribute__warn_unused_result__
@@ -4457,11 +4431,6 @@ PERL_CALLCONV NV Perl_sv_nv(pTHX_ SV* sv)
 #define PERL_ARGS_ASSERT_SV_NV \
        assert(sv)
 
-PERL_STATIC_INLINE bool        S_sv_only_taint_gmagic(SV *sv)
-                       __attribute__nonnull__(1);
-#define PERL_ARGS_ASSERT_SV_ONLY_TAINT_GMAGIC  \
-       assert(sv)
-
 PERL_CALLCONV char*    Perl_sv_peek(pTHX_ SV* sv);
 PERL_CALLCONV void     Perl_sv_pos_b2u(pTHX_ SV *const sv, I32 *const offsetp)
                        __attribute__nonnull__(pTHX_2);
@@ -5446,6 +5415,39 @@ STATIC SV *      S_incpush_if_exists(pTHX_ AV *const av, 
SV *dir, SV *const stem)
 
 #  endif
 #endif
+#if !defined(PERL_NO_INLINE_FUNCTIONS)
+PERL_STATIC_INLINE STRLEN      S__is_utf8_char_slow(const U8 *s, const U8 *e)
+                       __attribute__warn_unused_result__
+                       __attribute__nonnull__(1)
+                       __attribute__nonnull__(2);
+#define PERL_ARGS_ASSERT__IS_UTF8_CHAR_SLOW    \
+       assert(s); assert(e)
+
+PERL_STATIC_INLINE void        S_append_utf8_from_native_byte(const U8 byte, 
U8** dest)
+                       __attribute__nonnull__(2);
+#define PERL_ARGS_ASSERT_APPEND_UTF8_FROM_NATIVE_BYTE  \
+       assert(dest)
+
+PERL_STATIC_INLINE SSize_t     S_av_top_index(pTHX_ AV *av)
+                       __attribute__warn_unused_result__
+                       __attribute__nonnull__(pTHX_1);
+#define PERL_ARGS_ASSERT_AV_TOP_INDEX  \
+       assert(av)
+
+PERL_STATIC_INLINE bool        S_is_safe_syscall(pTHX_ const char *pv, STRLEN 
len, const char *what, const char *op_name)
+                       __attribute__warn_unused_result__
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_3)
+                       __attribute__nonnull__(pTHX_4);
+#define PERL_ARGS_ASSERT_IS_SAFE_SYSCALL       \
+       assert(pv); assert(what); assert(op_name)
+
+PERL_STATIC_INLINE bool        S_sv_only_taint_gmagic(SV *sv)
+                       __attribute__nonnull__(1);
+#define PERL_ARGS_ASSERT_SV_ONLY_TAINT_GMAGIC  \
+       assert(sv)
+
+#endif
 #if !defined(PERL_NO_UTF16_FILTER)
 #  if defined(PERL_IN_TOKE_C)
 STATIC U8*     S_add_utf16_textfilter(pTHX_ U8 *const s, bool reversed)
diff --git a/t/io/semctl.t b/t/io/semctl.t
index 53ae296..2e970a7 100644
--- a/t/io/semctl.t
+++ b/t/io/semctl.t
@@ -10,6 +10,8 @@ use strict;
 use warnings;
 
 skip_all('no SysV semaphores on this platform') if !$Config{d_sem};
+skip_all('SysV semaphore structures not detected')
+    if !$Config{d_semctl_semid_ds} && !$Config{d_semctl_semun};
 
 my @warnings;
 {
diff --git a/t/op/sprintf2.t b/t/op/sprintf2.t
index 2696d7f..8b12692 100644
--- a/t/op/sprintf2.t
+++ b/t/op/sprintf2.t
@@ -580,23 +580,27 @@ $o::count = 0;
 is $o::count,    0, 'sprintf %d string overload count is 0';
 is $o::numcount, 1, 'sprintf %d number overload count is 1';
 
-my $ppc64_linux = $Config{archname} =~ /^ppc64-linux/;
-my $irix_ld     = $Config{archname} =~ /^IP\d+-irix-ld$/;
+my $ppc_linux = $Config{archname} =~ /^(?:ppc|power(?:pc)?)(?:64)?-linux/;
+my $irix_ld   = $Config{archname} =~ /^IP\d+-irix-ld$/;
 
 for my $t (@hexfloat) {
     my ($format, $arg, $expected) = @$t;
     $arg = eval $arg;
     my $result = sprintf($format, $arg);
     my $ok = $result eq $expected;
-    if ($doubledouble && $ppc64_linux && $arg =~ /^2.71828/) {
-        # ppc64-linux has buggy exp(1).
+    # For certain platforms (all of which are currently double-double,
+    # but different implementations, GNU vs vendor, two different archs
+    # (ppc and mips), and two different libm interfaces) we have some
+    # bits-in-the-last-hexdigit differences.
+    # Patch them up as TODOs instead of deadly errors.
+    if ($doubledouble && $ppc_linux && $arg =~ /^2.71828/) {
+        # gets  '0x1.5bf0a8b1457695355fb8ac404ecp+1'
+        # wants '0x1.5bf0a8b1457695355fb8ac404e8p+1'
         local $::TODO = "$Config{archname} exp(1)";
         ok($ok, "'$format' '$arg' -> '$result' cf '$expected'");
         next;
     }
     if ($doubledouble && $irix_ld && $arg =~ /^1.41421/) {
-        # irix has buggy sqrt(2),
-        # last hexdigit one bit error:
         # gets  '0x1.6a09e667f3bcc908b2fb1366eacp+0'
         # wants '0x1.6a09e667f3bcc908b2fb1366ea8p+0'
         local $::TODO = "$Config{archname} sqrt(2)";
diff --git a/t/op/sub.t b/t/op/sub.t
index e8a561a..cf70d73 100644
--- a/t/op/sub.t
+++ b/t/op/sub.t
@@ -6,7 +6,7 @@ BEGIN {
     set_up_inc('../lib');
 }
 
-plan(tests => 39);
+plan(tests => 41);
 
 sub empty_sub {}
 
@@ -246,6 +246,13 @@ predeclared(); # set $x to 42
 $main::x = $main::x = "You should not see this.";
 inside_predeclared(); # run test
 
+# RT #126845: this used to fail an assertion in Perl_newATTRSUB_x()
+eval 'sub rt126845_1 (); sub rt126845_1 () :lvalue';
+pass("RT #126845: stub with prototype, then with attribute");
+
+eval 'sub rt126845_2 (); sub rt126845_2 () :lvalue {}';
+pass("RT #126845: stub with prototype, then definition with attribute");
+
 # RT #124156 death during unwinding causes crash
 # the tie allows us to trigger another die while cleaning up the stack
 # from an earlier die.
diff --git a/util.c b/util.c
index d057b71..28ea729 100644
--- a/util.c
+++ b/util.c
@@ -6050,7 +6050,7 @@ static const char* atos_parse(const char* p,
     *source_name_size = source_name_end - p;
     if (grok_atoUV(source_number_start, &uv,  &source_line_end)
         && source_line_end == close_paren
-        && uv <= MAX_STRLEN
+        && uv <= PERL_INT_MAX
     ) {
         *source_line = (STRLEN)uv;
         return p;
@@ -6117,14 +6117,14 @@ static void atos_symbolize(atos_context* ctx,
             char out[1024];
             UV cnt = fread(out, 1, sizeof(out), fp);
             if (cnt < sizeof(out)) {
-                const char* p = atos_parse(out + cnt, out,
+                const char* p = atos_parse(out + cnt - 1, out,
                                            source_name_size,
                                            source_line);
                 if (p) {
                     Newx(*source_name,
-                         *source_name_size + 1, char);
+                         *source_name_size, char);
                     Copy(p, *source_name,
-                         *source_name_size + 1,  char);
+                         *source_name_size,  char);
                 }
             }
             pclose(fp);
@@ -6249,14 +6249,15 @@ Perl_get_c_backtrace(pTHX_ int depth, int skip)
         for (i = skip; i < try_depth; i++) {
             Dl_info* dl_info = &dl_infos[i];
 
-            total_bytes += sizeof(Perl_c_backtrace_frame);
-
+            object_name_sizes[i] = 0;
             source_names[i] = NULL;
             source_name_sizes[i] = 0;
             source_lines[i] = 0;
 
             /* Yes, zero from dladdr() is failure. */
             if (dladdr(raw_frames[i], dl_info)) {
+                total_bytes += sizeof(Perl_c_backtrace_frame);
+
                 object_name_sizes[i] =
                     dl_info->dli_fname ? strlen(dl_info->dli_fname) : 0;
                 symbol_name_sizes[i] =

--
Perl5 Master Repository

Reply via email to