[Bug middle-end/96987] New: [11 regression] warning 'ptr' may be used uninitialized const pointer parameter

ibuclaw at gdcproject dot org gcc-bugzilla@gcc.gnu.org
Tue Sep 8 20:40:33 GMT 2020


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

            Bug ID: 96987
           Summary: [11 regression] warning 'ptr' may be used
                    uninitialized const pointer parameter
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ibuclaw at gdcproject dot org
  Target Milestone: ---

Possibly related to pr96564.  Remove 'const' from the prototype, and there is
no warning.

---
extern void constparam(const int *ptr);

int main()
{
    int* ptr = (int*)__builtin_malloc(sizeof(int) * 8);
    if (ptr != 0)
        constparam(ptr);
    return 0;
}


More information about the Gcc-bugs mailing list