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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-01-17
      Known to work|                            |10.3.0
            Summary|-Wmaybe-uninitialized false |[11/12 Regression]
                   |alarm on address of local   |-Wmaybe-uninitialized false
                   |array                       |alarm on address of local
                   |                            |array
      Known to fail|                            |11.1.0
           Keywords|                            |diagnostic
   Target Milestone|---                         |11.3

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed reduced further:
void *ptr_align (void const *ptr, unsigned long alignment);

int j (void)
{
  unsigned char j[10000];
  unsigned char *k = ptr_align (j, 1024);
  return !k;
}

The warning is suspect to make sure you have accessed something inside j before
the call to ptr_align but it looks like the warning just produces false
positive 100% of the time in this testcase and there is no way for the warning
to be shut up correctly..
There is no way for GCC to know what ptr_align does, GCC thinks it reads from
the first argument but it does not.

Note my recommendation to how to fix this is we should just revert this warning
which was added for GCC 11 and close the original bug which asks about this
warning as won't fix.

Reply via email to