In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/4caf7d8c4666d39b6b752a52ec5e19d9504f5f31?hp=4d00a3198aa6950e874328ec431d15c821382cce>
- Log ----------------------------------------------------------------- commit 4caf7d8c4666d39b6b752a52ec5e19d9504f5f31 Author: Daniel Dragan <[email protected]> Date: Sat Mar 26 13:44:30 2016 -0400 silence warnings in inline.h on Win64 VC build c:\p523\src\inline.h(211) : warning C4267: 'function' : conversion from 'size_t' to 'I32', possible loss of data c:\p523\src\inline.h(212) : warning C4267: 'function' : conversion from 'size_t' to 'I32', possible loss of data c:\p523\src\inline.h(421) : warning C4244: '=' : conversion from '__int64' to 'I 32', possible loss of data c:\p523\src\inline.h(423) : warning C4244: '=' : conversion from '__int64' to 'I 32', possible loss of data To fix the warnings at line 211 and 212, change the func to use a signed ptr length type. Although on x64, a 64b to 64b move instruction is 1 byte longer than a 32b to 32b move, so this commit adds a couple more bytes of machine code to the interp, but PVs len and cur are STRLEN, which is 64b on 64b OS, so something bad would happen if a very large off arg was passed to Perl_utf8_hop that was trucated to 32b, hence casting to silence the warning isn't appropriate, instead a bigger type is needed. S_cx_pushblock, a 8*(2^32), or 32 GB long perl stack malloc block is unrealistic. A 32 GB mark stack is infinite recursion. Cast away the warnings. ----------------------------------------------------------------------- Summary of changes: embed.fnc | 2 +- inline.h | 4 ++-- proto.h | 2 +- utf8.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/embed.fnc b/embed.fnc index d114b2b..ec5921a 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1642,7 +1642,7 @@ Ap |U8* |utf16_to_utf8 |NN U8* p|NN U8 *d|I32 bytelen|NN I32 *newlen Ap |U8* |utf16_to_utf8_reversed|NN U8* p|NN U8 *d|I32 bytelen|NN I32 *newlen AdpPR |STRLEN |utf8_length |NN const U8* s|NN const U8 *e ApdPR |IV |utf8_distance |NN const U8 *a|NN const U8 *b -ApdPRn |U8* |utf8_hop |NN const U8 *s|I32 off +ApdPRn |U8* |utf8_hop |NN const U8 *s|SSize_t off ApMd |U8* |utf8_to_bytes |NN U8 *s|NN STRLEN *len Apd |int |bytes_cmp_utf8 |NN const U8 *b|STRLEN blen|NN const U8 *u \ |STRLEN ulen diff --git a/inline.h b/inline.h index f448870..35983d8 100644 --- a/inline.h +++ b/inline.h @@ -418,9 +418,9 @@ S_cx_pushblock(pTHX_ U8 type, U8 gimme, SV** sp, I32 saveix) cx->cx_type = type; cx->blk_gimme = gimme; cx->blk_oldsaveix = saveix; - cx->blk_oldsp = sp - PL_stack_base; + cx->blk_oldsp = (I32)(sp - PL_stack_base); cx->blk_oldcop = PL_curcop; - cx->blk_oldmarksp = PL_markstack_ptr - PL_markstack; + cx->blk_oldmarksp = (I32)(PL_markstack_ptr - PL_markstack); cx->blk_oldscopesp = PL_scopestack_ix; cx->blk_oldpm = PL_curpm; cx->blk_old_tmpsfloor = PL_tmps_floor; diff --git a/proto.h b/proto.h index 044d31e..c43c4fc 100644 --- a/proto.h +++ b/proto.h @@ -3376,7 +3376,7 @@ PERL_CALLCONV IV Perl_utf8_distance(pTHX_ const U8 *a, const U8 *b) #define PERL_ARGS_ASSERT_UTF8_DISTANCE \ assert(a); assert(b) -PERL_CALLCONV U8* Perl_utf8_hop(const U8 *s, I32 off) +PERL_CALLCONV U8* Perl_utf8_hop(const U8 *s, SSize_t off) __attribute__warn_unused_result__ __attribute__pure__; #define PERL_ARGS_ASSERT_UTF8_HOP \ diff --git a/utf8.c b/utf8.c index 6249ea5..56d3322 100644 --- a/utf8.c +++ b/utf8.c @@ -1118,7 +1118,7 @@ on the first byte of character or just after the last byte of a character. */ U8 * -Perl_utf8_hop(const U8 *s, I32 off) +Perl_utf8_hop(const U8 *s, SSize_t off) { PERL_ARGS_ASSERT_UTF8_HOP; -- Perl5 Master Repository
