On 03-Sep-2017 04:30, Bram Moolenaar wrote:
Patch 8.0.1041
Problem:    Bogus characters appear when indenting kicks in while doing a
             visual-block append.
Solution:   Recompute when indenting is done. (Christian Brabandt)
Files:      runtime/doc/visual.txt, src/charset.c, src/edit.c, src/misc1.c,
             src/ops.c, src/proto/charset.pro, src/proto/misc1.pro,
             src/screen.c, src/spell.c, src/testdir/test_cindent.vim


After this patch, mingw (x64) throws this warning (on Win8.1 x64):
gcc -c -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -DFEAT_GUI_W32 -DFEAT_CLIPBOARD -pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return -s ops.c -o gobjnative/ops.o
ops.c: In function 'op_insert':
ops.c:2605:25: warning: 'ind_pre' may be used uninitialized in this function [-Wmaybe-uninitialized]
  bd.textcol += ind_post - ind_pre;
                ~~~~~~~~~^~~~~~~~~


ind_post is set unconditionally on line 2602, but ind_pre is only set if oap->block_mode is true.
The attached patch tries to fix it by initialising it to 0. Please check.

I am concerned about the struct block_def variable 'bd' (declared on line 2511). It's .is_MAX member is set unconditionally (line 2516), but it's other members only seem to be set via the call to block_prep() if oap->block_mode is true (line 2544). Or am I missing something?

Cheers
John

--
--
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.
--- ops.c       2017-09-03 05:31:32.305644000 +1000
+++ ops.c.new   2017-09-03 05:56:40.572734500 +1000
@@ -2507,7 +2507,7 @@
 {
     long               ins_len, pre_textlen = 0;
     char_u             *firstline, *ins_text;
-    colnr_T            ind_pre, ind_post;
+    colnr_T            ind_pre = 0, ind_post;
     struct block_def   bd;
     int                        i;
     pos_T              t1;

Raspunde prin e-mail lui