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

            Bug ID: 82839
           Summary: missing -Wmaybe-uninitialized warning
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arnd at linaro dot org
  Target Milestone: ---

I stumbled across a bug in the linux kernel and was surprised that gcc had not
warned about it. I manually created a reduced version:

extern void h(int *t);
extern int g(void);
void f(int *t, int b)
{
        int ts;
        g();
        *t = ts;

        switch (b) {
        case 0:
                h(&ts);
        };
}
gcc -Wall -O2 test.c -c


No gcc version I tried (gcc-3.4 through 8.0) warned about it in any
optimization level I tried. I also tried with clang, which did warn about it
correctly. I realize that there are many other open bugs about missing
-Wuninitialized warning and many duplicates, but I could not find any that are
like this one on a non-exhaustive search.

Reply via email to