diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-05-22 21:53:26 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-05-22 21:53:26 +0100 |
commit | 5b529230f144028b67ed1d59207af098c18a1858 (patch) | |
tree | bb4c2fe4272296a78960bdb0f8b1a6e5b30cc92c | |
parent | 338bf58eba758585ffef3fdfdba7d48477aacb7c (diff) | |
download | vim-git-8.2.5005.tar.gz |
patch 8.2.5005: compiler warning for uninitialized variablev8.2.5005
Problem: Compiler warning for uninitialized variable. (John Marriott)
Solution: Initialize the pointer to NULL.
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9expr.c | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/version.c b/src/version.c index e8799ad57..f0ccd2086 100644 --- a/src/version.c +++ b/src/version.c @@ -735,6 +735,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 5005, +/**/ 5004, /**/ 5003, diff --git a/src/vim9expr.c b/src/vim9expr.c index 3e720d913..6fb32cb6d 100644 --- a/src/vim9expr.c +++ b/src/vim9expr.c @@ -2635,8 +2635,6 @@ compile_expr5(char_u **arg, cctx_T *cctx, ppconst_T *ppconst) char_u *next; int len = 2; int ppconst_used = ppconst->pp_used; - typval_T *tv1; - typval_T *tv2; isn_T *isn; // get the first variable @@ -2662,8 +2660,7 @@ compile_expr5(char_u **arg, cctx_T *cctx, ppconst_T *ppconst) // Handle a bitwise left or right shift operator if (ppconst->pp_used == ppconst_used + 1) { - tv1 = &ppconst->pp_tv[ppconst->pp_used - 1]; - if (tv1->v_type != VAR_NUMBER) + if (ppconst->pp_tv[ppconst->pp_used - 1].v_type != VAR_NUMBER) { // left operand should be a number emsg(_(e_bitshift_ops_must_be_number)); @@ -2702,8 +2699,10 @@ compile_expr5(char_u **arg, cctx_T *cctx, ppconst_T *ppconst) if (ppconst->pp_used == ppconst_used + 2) { + typval_T *tv1 = &ppconst->pp_tv[ppconst->pp_used - 2]; + typval_T *tv2 = &ppconst->pp_tv[ppconst->pp_used - 1]; + // Both sides are a constant, compute the result now. - tv2 = &ppconst->pp_tv[ppconst->pp_used - 1]; if (tv2->v_type != VAR_NUMBER || tv2->vval.v_number < 0) { // right operand should be a positive number @@ -2825,7 +2824,7 @@ compile_expr4(char_u **arg, cctx_T *cctx, ppconst_T *ppconst) if (ppconst->pp_used == ppconst_used + 2) { - typval_T * tv1 = &ppconst->pp_tv[ppconst->pp_used - 2]; + typval_T *tv1 = &ppconst->pp_tv[ppconst->pp_used - 2]; typval_T *tv2 = &ppconst->pp_tv[ppconst->pp_used - 1]; int ret; |