On 9/15/20 1:00 PM, Martin Sebor via Gcc-patches wrote: > The -Wuninitialized/-Wmaybe-uninitialized enhancement to warn when > a pointer or reference to an uninitialized object is passed to > a const-qualified function argument tries to avoid triggering for > objects of empty types. However, the suppression is incomplete > and lets the warning trigger in some corner cases. The attached > patch extends the suppression to those as well. > > Tested on x86_64-linux. I will plan to commit it later this week > if there are no objections. > > Martin > > gcc-96295.diff > > Work harder to avoid -Wuninitialized for objects of empty structs (PR > middle-end/96295). > > Resolves: > PR middle-end/96295 - -Wmaybe-uninitialized warning for range operator with > reference to an empty struct > > gcc/ChangeLog: > > PR middle-end/96295 > * tree-ssa-uninit.c (maybe_warn_operand): Work harder to avoid > warning for objects of empty structs > > gcc/testsuite/ChangeLog: > > PR middle-end/96295 > * g++.dg/warn/Wuninitialized-11.C: New test.
FWIW, we had a build in Fedora rawhide fail just in the last couple weeks because of the enhanced uninitialized warning. I've already forgotten the package, but it was a true positive, though sadly it was just in the package's testsuite and thus we didn't actually find/fix a user visible package bug. OK for the trunk. Thanks. jeff
pEpkey.asc
Description: application/pgp-keys