[Bug ipa/87706] New: Inlined functions trigger invalid -Wmissing-profile warning

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 23 12:49:00 GMT 2018


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

            Bug ID: 87706
           Summary: Inlined functions trigger invalid -Wmissing-profile
                    warning
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

Considering following example:

$ cat sra-6.c
int g;

static
void cow (int a, int b)
{
  if (a)
    g = 123;
}

int main(int argc, char **argv)
{
  cow (argc, 0);
  return 0;
}

One can see:

$ gcc sra-6.c  -O2 -fprofile-generate -Wall && ./a.out && gcc sra-6.c  -O2
-fprofile-use
sra-6.c: In function ‘cow’:
sra-6.c:4:6: warning: profile for function ‘cow’ not found in profile data
[-Wmissing-profile]
    4 | void cow (int a, int b)
      |      ^~~

Problem is the function 'cow' is removed in IPA passes and as IPA profile
happens before it we see the warning.

One possible solution would be to mark all cgraph_nodes with missing profile
and emit warnings later after we have final symbols.

Honza?


More information about the Gcc-bugs mailing list