Yegappan wrote:

> When I run the test_vim9_expr.vim test on MacOS with Vim 8.2.2029),
> I see that VIm crashes with a bad instruction exception.
> 
> * thread #1, queue = 'com.apple.main-thread', stop reason =
> EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
> 
> I see this crash only when building Vim with debug symbols (-g -O0).
> If I build Vim without the debug symbols, I don't see this problem.
> I also don't see this crash with the ASAN and UBSAN builds.
> 
> Is this a bug in the compiler? I am using the following Clang compiler on
> Catalina:
> 
> Apple clang version 12.0.0 (clang-1200.0.32.21)
> Target: x86_64-apple-darwin19.6.0
> 
> The complete traceback is below:
> 
> * thread #1, queue = 'com.apple.main-thread', stop reason =
> EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
>   * frame #0: 0x00007fff6af56fca
> libsystem_c.dylib`__chk_fail_overflow.cold.1 + 16
>     frame #1: 0x00007fff6af54214 libsystem_c.dylib`__chk_fail_overflow + 9
>     frame #2: 0x00007fff6af543f0 libsystem_c.dylib`__strcpy_chk + 83
>     frame #3: 0x000000010029287b
> vim`add_vim9_script_var(di=0x0000000100606550, tv=0x00007ffeefbf9178,
> type=0x0000000000000000) at vim9script.c:604:2

This is:

        STRCPY(&newsav->sav_key, di->di_key);

And "sav_key" is a one byte array, that is actually longer.  This looks
like the FORTIFY_SOURCE problem.  Configure only adds this for GCC 4 and
higher, perhaps we also need it for clang?

You could try adding this to the clang command:
         -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1


-- 
Microsoft's definition of a boolean: TRUE, FALSE, MAYBE
"Embrace and extend"...?

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202011211457.0ALEv6Yb938930%40masaka.moolenaar.net.

Raspunde prin e-mail lui