[ZBX-16287] Compiler warnings in host.c Created: 2019 Jun 20  Updated: 2024 Apr 10  Resolved: 2019 Jul 23

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Proxy (P), Server (S)
Affects Version/s: 4.4.0alpha1
Fix Version/s: 4.0.11rc1, 4.2.5rc1, 4.4.0alpha1, 4.4 (plan)

Type: Problem report Priority: Trivial
Reporter: Glebs Ivanovskis Assignee: Aleksejs Sestakovs
Resolution: Fixed Votes: 0
Labels: codequality, warning
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File host.patch    
Team: Team C
Sprint: Sprint 53 (Jun 2019), Sprint 54 (Jul 2019)
Story Points: 0.125

 Description   

Steps to reproduce:

  1. Compile Zabbix server or proxy from source using -O2 -Wall
    Making all in zbxdbhigh
    host.c: In function ‘DBcopy_template_host_prototypes’:
    host.c:3360:80: warning: ‘host_prototype’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         group_prototype = (zbx_group_prototype_t *)host_prototype->group_prototypes.values[i];
                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    host.c:3265:24: note: ‘host_prototype’ was declared here
      zbx_host_prototype_t *host_prototype;
                            ^~~~~~~~~~~~~~
    host.c:3227:47: warning: ‘host_prototype’ may be used uninitialized in this function [-Wmaybe-uninitialized]
        if (FAIL == (i = zbx_vector_uint64_bsearch(&host_prototype->lnk_templateids, templateid,
                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    host.c:3140:24: note: ‘host_prototype’ was declared here
      zbx_host_prototype_t *host_prototype;
                            ^~~~~~~~~~~~~~
    

Result:

Expected:
No warnings. See host.patch.



 Comments   
Comment by Aleksejs Sestakovs [ 2019 Jul 17 ]

Available in versions:

  • 4.0.11rc1 c9f5abe402
  • 4.2.5rc1 1698471ff8
  • 4.4.0alpha1 (trunk) 5fe0f6141c
Generated at Sat Apr 27 02:35:06 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.