Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1807781
Summary: | false positive "may be used uninitialized" warning | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Dan Horák <dan> | ||||
Component: | kernel-tools | Assignee: | Justin M. Forbes <jforbes> | ||||
Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | unspecified | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | rawhide | CC: | aoliva, avi.kivity, dmalcolm, fweimer, jakub, jcline, jeremy, jforbes, jwakely, jwboyer, labbott, law, mpolacek, msebor, nickc, pbrobinson | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | s390x | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | kernel-tools-5.6.0-300.fc32 | Doc Type: | If docs needed, set a value | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2020-04-06 18:23:06 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: | |||||||
Bug Depends On: | |||||||
Bug Blocks: | 467765, 1793473 | ||||||
Attachments: |
|
Description
Dan Horák
2020-02-27 09:03:57 UTC
still there with gcc-10.0.1-0.9.fc33.s390x Jakub expects this is related to s390x inlining heuristics. The problem can be produced with "--param=inline-min-speedup=2 --param=max-inline-insns-auto=80" added to CFLAGS on eg. ppc64le too. Jeremy, Justin, I would suggest to omit the -Werror option from the build flags. Another approach if they don't want to remove the -Werror would be to use the pragma mechanisms to disable the warning in the place where it happens. Something like this #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmaybe-uninitialized <code with the false positive> #pragma GCC diagnostic pop BTW, the reason for the warning is that the compiler doesn't know what the authors of netlink.c assume, namely that if socket or bind or getsockname return a negative return value, then errno (expanded as *__errno_location ()) will be in the range [1, INT_MAX]. GCC right now has no attribute or whatever other way to express such invariant nor are those functions builtin for which it would hardcode such knowledge. So, if the function initializes what the pointer points to only in the ultimate success case and the compiler doesn't know that all the early exits that return -errno (and will keep what the pointer points to uninitialized) will return negative, then it has to emit the maybe uninitialized warning and the only reason why it isn't emitted otherwise is that the function isn't inlined. Now, perhaps this is quite frequent special case and we could have some attribute that C libraries could ensure such behavior and teach VRP about that, but that doesn't look like GCC 10 material at this point. IMHO the best way to workaround the warning is to *nl_pid = 0; at the start of libbpf_netlink_open or initialize nl_pid to some value in the callers before calling that function. Or one can __u32 nl_pid = nl_pid; to disable the warning while keeping it uninitialized. Sorry for the glacial response. I've finally gotten around to sending a fix upstream[0] and I've built kernel-tools for Fedora 32. [0]https://lore.kernel.org/lkml/20200404051430.698058-1-jcline@redhat.com/ |