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

            Bug ID: 80787
           Summary: gcc -Wmaybe-uninitialized false negative when
                    compiling Emacs
           Product: gcc
           Version: 7.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eggert at gnu dot org
  Target Milestone: ---

I found this problem when compiling GNU Emacs with GCC 7.1.0 and with Clang
3.9.1.  GCC missed an uninitialized-variable bug that Clang correctly warned
about. To reproduce the problem with GCC 7.1.0 x86-64, compile the following
stripped-down test case:

  _Bool
  xg_update_scrollbar_pos (int a, int b)
  {
    _Bool hidden;
    if (a < b)
      hidden = 1;
    return !hidden;
  }

using the command:

  gcc -O2 -Wall -S u.i

GCC does not warn, even though 'hidden' is a possibly-uninitialized variable.
With the same options, Clang warns about the bug.

Reply via email to