[Bug middle-end/93100] gcc -fsanitize=address inhibits -Wuninitialized

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Apr 16 22:31:17 GMT 2021


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |10.2.1, 11.0, 9.3.0
                 CC|                            |msebor at gcc dot gnu.org
          Component|sanitizer                   |middle-end
   Last reconfirmed|2020-01-09 00:00:00         |2021-4-16
             Status|NEW                         |ASSIGNED
         Depends on|                            |98508
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Reconfirming with GCC 11.  The reason for the false negative is that
instrumentation functions injected by the sanitizers look to the warning like
they might initialize the variables.  That's simply because the warning hasn't
been taught they're special and don't write to the variables.  The patch in
pr98508 comment 5 enables the warning.  Let me submit it for GCC 12.

void f ()
{
  struct A b;
  struct A a;
  int _1;

  <bb 2> :
  # .MEM_4 = VDEF <.MEM_3(D)>
  .ASAN_MARK (UNPOISON, &a, 8);   <<< assumed to write to a
  # VUSE <.MEM_4>
  _1 = a.i;                       <<< missing warning
  if (_1 != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  # .MEM_5 = VDEF <.MEM_4>
  b = a;

  <bb 4> :
  # .MEM_2 = PHI <.MEM_4(2), .MEM_5(3)>
  # .MEM_6 = VDEF <.MEM_2>
  .ASAN_MARK (POISON, &a, 8);
  # VUSE <.MEM_6>
  return;

}


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98508
[Bug 98508] Sanitizer disable -Wall and -Wextra


More information about the Gcc-bugs mailing list