Warning at line 3095 of buffer.c in Normal, Big and Huge after applying patches 8.1.2257 to .2266

10 views
Skip to first unread message

Tony Mechelynck

unread,
Nov 6, 2019, 4:32:41 PM11/6/19
to Bram Moolenaar, vim_dev
Warning at line 3095 of buffer.c in Normal, Big and Huge after
applying patches 8.1.2257 to .2266:

gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread
-I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include
-I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo
-I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/libpng16
-I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0
-I/usr/include/harfbuzz -I/usr/include/pango-1.0
-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
-I/usr/include/freetype2 -O2 -fno-strength-reduce -Wall
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/buffer.o
buffer.c
buffer.c: In function ‘buflist_list’:
buffer.c:3095:50: warning: ‘p’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
? (++p < buflist_data + buflist.ga_len ? *p : NULL)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~

Best regards,
Tony.

Bram Moolenaar

unread,
Nov 6, 2019, 5:27:53 PM11/6/19
to vim...@googlegroups.com, Tony Mechelynck
The compiler doesn't see that when buflist_data is non-null then "p" is
initialized. Let's rearrange the code a bit.

--
Seen it all, done it all, can't remember most of it.

/// Bram Moolenaar -- Br...@Moolenaar.net -- 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 ///
Reply all
Reply to author
Forward
0 new messages