[Bug tree-optimization/89202] New: missing -Wnonnull-dereference or -Wuninitialized for a certain bug

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Feb 5 04:09:00 GMT 2019


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

            Bug ID: 89202
           Summary: missing -Wnonnull-dereference or -Wuninitialized for a
                    certain bug
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

The following function either reads a variable that has not been initialized or
dererefernces a null pointer, but can never be executed without an error.  Yet
GCC issues neither -Wuninitialized/-Wmaybe-uninitialized nor
-Wnull-dereference.

$ cat z.c && gcc -O2 -S -Wall -Wextra -Wnull-dereference
-fdump-tree-optimized=/dev/stdout z.c
void f (int *s)
{
  int i;

  if (!s)
    i = 0;

  *s = i;
}

;; Function f (f, funcdef_no=0, decl_uid=1906, cgraph_uid=1, symbol_order=0)

f (int * s)
{
  <bb 2> [local count: 1073741824]:
  *s_1(D) = 0;
  return;

}


More information about the Gcc-bugs mailing list