[MDEV-13786] compiler complains about uninitialized variable. Created: 2017-09-12  Updated: 2017-09-12  Resolved: 2017-09-12

Status: Closed
Project: MariaDB Server
Component/s: JSON
Affects Version/s: 10.2
Fix Version/s: 10.2.9

Type: Bug Priority: Major
Reporter: Alexey Botchkov Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: None


 Description   

Compiler complains like this:

/mariadb/10.2/sql/item_jsonfunc.cc:878:7: warning: variable 'i' is used
uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (read_json(NULL, &type, &value, &value_len) != NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mariadb/10.2/sql/item_jsonfunc.cc:898:10: note: uninitialized use occurs here
return i;
^
/mariadb/10.2/sql/item_jsonfunc.cc:878:3: note: remove the 'if' if its condition
is always true
if (read_json(NULL, &type, &value, &value_len) != NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mariadb/10.2/sql/item_jsonfunc.cc:876:13: note: initialize the variable 'i' to
silence this warning
longlong i;
^
= 0


Generated at Thu Feb 08 08:08:20 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.