Bug 2141218
Summary: | qemu-kvm build fails with clang 15.0.1 due to false unused variable error | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 9 | Reporter: | Miroslav Rezanina <mrezanin> | ||||
Component: | qemu-kvm | Assignee: | Miroslav Rezanina <mrezanin> | ||||
qemu-kvm sub component: | General | QA Contact: | jingzhao <jinzhao> | ||||
Status: | CLOSED ERRATA | Docs Contact: | |||||
Severity: | urgent | ||||||
Priority: | unspecified | CC: | coli, jchecahi, juzhang, mprchlik, sipoyare, virt-maint | ||||
Version: | 9.2 | Keywords: | Triaged | ||||
Target Milestone: | rc | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | qemu-kvm-7.1.0-5.el9 | Doc Type: | If docs needed, set a value | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2023-05-09 07:20:51 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Hit different error on another build: ../qemu-img.c:4925:13: error: variable 'block_count' set but not used [-Werror,-Wunused-but-set-variable] int64_t block_count = 0, out_pos, in_pos; ^ 1 error generated. Closer inspection shows that in both cases, variable is used only with ++ operator. Is there any change in logic for unused variables in 15.0.1 that cause this kind of usage is now reported as unused variable? (In reply to Miroslav Rezanina from comment #2) > Closer inspection shows that in both cases, variable is used only with ++ > operator. Is there any change in logic for unused variables in 15.0.1 that > cause this kind of usage is now reported as unused variable? Yes, there was an improvement to that diagnostic that caused it to start detecting when the only use was with ++ operator: https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html#improvements-to-clang-s-diagnostics Do you have a link to the full source file? (In reply to Tom Stellard from comment #3) > (In reply to Miroslav Rezanina from comment #2) > > Closer inspection shows that in both cases, variable is used only with ++ > > operator. Is there any change in logic for unused variables in 15.0.1 that > > cause this kind of usage is now reported as unused variable? > > Yes, there was an improvement to that diagnostic that caused it to start > detecting when the only use was with ++ operator: > https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes. > html#improvements-to-clang-s-diagnostics > > Do you have a link to the full source file? I miss on original warning that code reading the variable is disabled. I detected four new places causing this warning and already sent fixes upstream: https://lists.nongnu.org/archive/html/qemu-devel/2022-11/msg01639.html You can see the files here: https://git.qemu.org/?p=qemu.git;a=blob;f=qemu-img.c;h=a3b64c88af0f4fce8da9521206ef6a2302bb80e8;hb=HEAD https://git.qemu.org/?p=qemu.git;a=blob;f=hw/usb/host-libusb.c;h=28f8af8941ff6db20283fcd85d23da120abc6cee;hb=HEAD https://git.qemu.org/?p=qemu.git;a=blob;f=hw/net/tulip.c;h=b9e42c322ab1fb92416adfc5fda94a93c77543cf;hb=HEAD https://git.qemu.org/?p=qemu.git;a=blob;f=hw/net/rtl8139.c;h=6b65823b4bf8cab4e5d208f5abcbbbd4343041d3;hb=HEAD As the issue is not on the side of compiler, reassign to qemu-kvm that has to fix this. QE bot(pre verify): Set 'Verified:Tested,SanityOnly' as gating/tier1 test pass. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: qemu-kvm security, bug fix, and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2023:2162 |
Created attachment 1923290 [details] Brew build log for failed build When running qemu-kvm build for RHEL 9.2 using clang 15.0.1, build fails with following error: ../hw/usb/host-libusb.c:1840:9: error: variable 'unconnected' set but not used [-Werror,-Wunused-but-set-variable] int unconnected = 0; ^ 1 error generated. Checking the source shows that variable is used and this error is false pass. Building exactly same code with clang 14.0.6 finished successfully.