(Spurious?) "Maybe unintialized" warning in vim9execute.c after applying patches (8.2) 2328 to 2332

9 views
Skip to first unread message

Tony Mechelynck

unread,
Jan 11, 2021, 8:44:39 PM1/11/21
to Bram Moolenaar, vim_dev
The warning happens in all builds except Tiny and Small, as seen
below. I believe that this warning is spurious because just above it
there is (omitting irrelevant code)

if (name != NULL)
{
if (error != FCERR_NONE)
res = FAIL;
else
res = call_by_name(fname, argcount, ectx, NULL);
}

Now here are the compiler's command-line and message:

gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread
-I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0
-I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0
-I/usr/lib64/dbus-1.0/include -I/usr/include/gtk-3.0
-I/usr/include/gio-unix-2.0 -I/usr/include/libxkbcommon
-I/usr/include/wayland -I/usr/include/cairo -I/usr/include/pango-1.0
-I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/atk-1.0
-I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2
-I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0
-I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid
-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -O2
-fno-strength-reduce -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
-o objects/vim9execute.o vim9execute.c
vim9execute.c: In function ‘call_partial.isra.6’:
vim9execute.c:803:29: warning: ‘res’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
if (name == NULL || res == FAIL)

An executable is produced in all cases.

Best regards,
Tony.

Bram Moolenaar

unread,
Jan 12, 2021, 11:18:32 AM1/12/21
to vim...@googlegroups.com, Tony Mechelynck

Tony wrote:

> The warning happens in all builds except Tiny and Small, as seen
> below. I believe that this warning is spurious because just above it
> there is (omitting irrelevant code)
>
> if (name != NULL)
> {
> if (error != FCERR_NONE)
> res = FAIL;
> else
> res = call_by_name(fname, argcount, ectx, NULL);
> }

Yeah, looks like the compiler doesn't see the relateion with "name".
I'll fix it.


--
hundred-and-one symptoms of being an internet addict:
131. You challenge authority and society by portnuking people

/// 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