vim-patch:8.2.3573: cannot decide whether to skip test that fails with 64 bit

Problem:    Cannot decide whether to skip test that fails with 64 bit ints.
            (closes vim/vim#9072)
Solution:   Add v:sizeofint, v:sizeoflong and v:sizeofpointer.  Improve the
            check for multiply overflow.
69b3072d98

Omit v:sizeof{int,long,pointer} as they're only really used for tests.
This commit is contained in:
Sean Dewar 2022-02-16 21:23:08 +00:00
parent a256b710a2
commit b149665689
No known key found for this signature in database
GPG Key ID: 08CC2C83AD41B581
3 changed files with 5 additions and 8 deletions

View File

@ -494,6 +494,9 @@ Eval:
*js_encode()* *js_encode()*
*js_decode()* *js_decode()*
*v:none* (used by Vim to represent JavaScript "undefined"); use |v:null| instead. *v:none* (used by Vim to represent JavaScript "undefined"); use |v:null| instead.
*v:sizeofint*
*v:sizeoflong*
*v:sizeofpointer*
Events: Events:
*SigUSR1* Use |Signal| to detect `SIGUSR1` signal instead. *SigUSR1* Use |Signal| to detect `SIGUSR1` signal instead.

View File

@ -3434,7 +3434,8 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
const long multlen = count * yanklen; const long multlen = count * yanklen;
totlen = (size_t)(int)multlen; totlen = (size_t)(int)multlen;
if (totlen != (size_t)multlen) { if (totlen != (size_t)multlen || (long)totlen / count != yanklen
|| (long)totlen / yanklen != count) {
emsg(_(e_resulting_text_too_long)); emsg(_(e_resulting_text_too_long));
break; break;
} else if (totlen > 0) { } else if (totlen > 0) {

View File

@ -139,13 +139,6 @@ func Test_p_with_count_leaves_mark_at_end()
endfunc endfunc
func Test_very_large_count() func Test_very_large_count()
" FIXME: should actually check if sizeof(int) == sizeof(long)
CheckNotMSWindows
if v:numbersize != 64
throw 'Skipped: only works with 64 bit numbers'
endif
new new
let @" = 'x' let @" = 'x'
call assert_fails('norm 44444444444444p', 'E1240:') call assert_fails('norm 44444444444444p', 'E1240:')