Hi,

On Wed, Dec 14, 2016 at 12:44 AM, Dominique Pellé
<dominique.pe...@gmail.com> wrote:
> Yegappan Lakshmanan wrote:
>
>> Hi all,
>>
>> When running the Vim tests with UBSan, the following errors are
>> reported:
>>
>> channel.c:713:5: runtime error: load of misaligned address
>> 0x60b0000069ca for type 'char *', which requires 8 byte alignment
>> 0x60b0000069ca: note: pointer points here
>
> Line 713 is is this for me:
>

Yes. I forgot to include the relevant code information in my e-mail.

>
>  713     memcpy((char *)&server.sin_addr, host->h_addr, host->h_length);
>
> I don't see this error with ubsan. A char* should not require 8 byte
> alignment anyway. Strange.
>

I am building Vim (8.0.133) on MacOS with the following sanitizer flags:

SANITIZER_CFLAGS = -g -O0 -fsanitize=address,undefined -fno-omit-frame-pointer

I am using the tools from the latest Xcode 8.2.

I am not sure how to fix these errors though.

Regards,
Yegappan

>
>> 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.
>
> Dominique
>

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui