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

            Bug ID: 68025
           Summary: pragma/attribute optimize("profile-arcs") does not
                    work as intended
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
          Assignee: unassigned at gcc dot gnu.org
          Reporter: coolypf at qq dot com
  Target Milestone: ---

Case 1. The following code, when compiled, both x and y are instrumented:

#pragma GCC push_options
#pragma GCC optimize("profile-arcs")

int x(int p)
{
if (p > 0) return 1;
return 0;
}

#pragma GCC pop_options

int y(int q)
{
if (q < 0) return 0;
return 1;
}


Case 2. The following code, when compiled, both x and y are instrumented:

int x(int) __attribute__ ((optimize("profile-arcs")));

int x(int p)
{
if (p > 0) return 1;
return 0;
}

int y(int q)
{
if (q < 0) return 0;
return 1;
}


Case 3. The following code, when compiled, both x and y are instrumented:

int x(int p)
{
if (p > 0) return 1;
return 0;
}

#pragma GCC push_options
#pragma GCC optimize("profile-arcs")

int y(int q)
{
if (q < 0) return 0;
return 1;
}

#pragma GCC pop_options


Case 4. The following code, when compiled, both x and y are instrumented:

int x(int p)
{
if (p > 0) return 1;
return 0;
}

int y(int) __attribute__ ((optimize("profile-arcs")));

int y(int q)
{
if (q < 0) return 0;
return 1;
}

Reply via email to