[Bug middle-end/98871] Cannot silence -Wmaybe-uninitialized at declaration site

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jan 29 00:49:01 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98871

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |middle-end
   Last reconfirmed|                            |2021-01-29
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=98465,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=98512
     Ever confirmed|0                           |1
           Keywords|                            |diagnostic
                 CC|                            |msebor at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
             Blocks|                            |24639

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed.  The root cause of the problem is that the #pragma diagnostic
suppression machinery consider only one location but that location may be
different depending on the warning and depending on inlining.  For some
warnings it's the location of the call site into which the problem statement
has been inlined.  For others it might be the original location of the
statement itself.  -Wuninitialized and -Wmaybe-uninitialized happen to fall
into the first category.

The solution I posted for pr98465 and pr98512 lets it consider both (or all
locations along the inlining stack) and, with an minor extension, makes the
suppression work in this case as well.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639
[Bug 24639] [meta-bug] bug to track all Wuninitialized issues


More information about the Gcc-bugs mailing list