[tarantool-patches] [PATCH v1] build: LTO release build fails

Alexander V. Tikhonov avtikhon at tarantool.org
Thu Sep 19 11:17:57 MSK 2019


LTO build failed because of warnings on the uninitialized
variables treated as errors:

/mnt/src/box/tuple_update.c: In function ‘do_op_splice’:
/mnt/src/box/tuple_update.c:764:15: error: ‘str_len’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   arg->offset = str_len;
               ^
/mnt/src/box/tuple_update.c:755:10: note: ‘str_len’ was declared here
  int32_t str_len;
          ^
/mnt/src/box/tuple_update.c: In function ‘do_op_bit’:
/mnt/src/box/tuple_update.c:725:12: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   arg->val &= val;
            ^
/mnt/src/box/tuple_update.c:720:11: note: ‘val’ was declared here
  uint64_t val;
           ^
/mnt/src/box/tuple_update.c: In function ‘update_read_ops’:
/mnt/src/box/tuple_update.c:1068:4: error: ‘field_no’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
    diag_set(ClientError, ER_NO_SUCH_FIELD_NO, field_no);
    ^
/mnt/src/box/tuple_update.c:1057:10: note: ‘field_no’ was declared here
  int32_t field_no;
          ^
lto1: all warnings being treated as errors

Fixed by setting variables to 0 value on initializations.

Closed #4512
---

Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-4512-lto-build-full-ci
Issue: https://github.com/tarantool/tarantool/issues/4512

 src/box/tuple_update.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/box/tuple_update.c b/src/box/tuple_update.c
index 42f5190af..66f48f317 100644
--- a/src/box/tuple_update.c
+++ b/src/box/tuple_update.c
@@ -717,7 +717,7 @@ do_op_bit(struct tuple_update *update, struct update_op *op)
 	if (field->op != NULL)
 		return update_err_double(op);
 	const char *old = field->old;
-	uint64_t val;
+	uint64_t val = 0;
 	if (mp_read_uint(op, &old, &val) != 0)
 		return -1;
 	switch (op->opcode) {
@@ -752,7 +752,7 @@ do_op_splice(struct tuple_update *update, struct update_op *op)
 	struct op_splice_arg *arg = &op->arg.splice;
 
 	const char *in = field->old;
-	int32_t str_len;
+	int32_t str_len = 0;
 	if (mp_read_str(op, &in, (uint32_t *) &str_len, &in) != 0)
 		return -1;
 
@@ -1054,7 +1054,7 @@ update_op_decode(struct update_op *op, int index_base,
 		diag_set(ClientError, ER_UNKNOWN_UPDATE_OP);
 		return -1;
 	}
-	int32_t field_no;
+	int32_t field_no = 0;
 	switch(mp_typeof(**expr)) {
 	case MP_INT:
 	case MP_UINT: {
-- 
2.17.1





More information about the Tarantool-patches mailing list