On 14/12/2016 08:44, Dominique Pellé wrote:
Yegappan Lakshmanan wrote:
eval.c:4432:10: runtime error: negation of -9223372036854775808 cannot
be represented in type 'varnumber_T' (aka 'long long'); cast to an
unsigned type to negate this value to itself

I see it too.
It's coming from this line in Test_num64() in test_viml.vim:

call assert_equal(-9223372036854775808,  0 / 0)

Running  :echo -9223372036854775808
also gives the ubsan error.

viml parser is considering the number 9223372036854775808
(which is not a valid long long) and then negating it, instead
of considering it as number -9223372036854775808
(which is a valid long long). Not sure how it can be fix.
Even though it's undefined behavior, it probably works
on all platforms in practice.  The test would probably
fail if it did not work. But it would be good to avoid undefined
behavior.

The usual idiom for writing an integer constant for the largest negative value 2s complement integer is to negate the largest positive value and subtract 1. So use (-9223372036854775807 - 1)?

Mike
--
Don't play with matches. Lighters work much better.

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui