gcc warning after patch 8.2.1017 to 8.2.1033

5 views
Skip to first unread message

John Marriott

unread,
Jun 21, 2020, 3:36:20 PM6/21/20
to vim...@googlegroups.com
Hi All,

After updating my sources from 8.1.1017 up to 8.2.1033, mingw64 (gcc
10.1.1) started throwing this warning:
<snip>
gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -pipe -march=native -Wall
-O3 -fomit-frame-pointer -freg-struct-return -fpie -fPIE
-DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD vim9compile.c -o gobjnative/vim9compile.o
vim9compile.c: In function 'compile_expr1':
vim9compile.c:4443:6: warning: 'type1' may be used uninitialized in this
function [-Wmaybe-uninitialized]
 4443 |      common_type(type1, type2, &type2, cctx->ctx_type_list);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim9compile.c:4446:38: warning: 'end_idx' may be used uninitialized in
this function [-Wmaybe-uninitialized]
 4446 |      isn = ((isn_T *)instr->ga_data) + end_idx;
      |                                      ^
</snip>

I'm not sure which patch is causing gcc to have a little fit, but the
attached patch tries to calm it down.
Note that I defaulted a few extra variables just to make it consistent.

Cheers
John

vim9compile.c.8.2.1033.patch

Bram Moolenaar

unread,
Jun 21, 2020, 4:18:01 PM6/21/20
to vim...@googlegroups.com, John Marriott
Thanks. My gcc doesn't complain, seems to be a bit more clever.

--
ARTHUR: But if he was dying, he wouldn't bother to carve
"Aaaaarrrrrrggghhh". He'd just say it.
BROTHER MAYNARD: It's down there carved in stone.
GALAHAD: Perhaps he was dictating.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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