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

            Bug ID: 104381
           Summary: [12 Regression] -gtoggle no longer applied when using
                    optimize attribute
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

int foo (int x)
{
  int tem = x + 1;
  int tem2 = tem - 1;
  return tem2;
}

int __attribute__((optimize("no-tree-pre"))) bar (int x)
{
  int tem = x + 1;
  int tem2 = tem - 1;
  return tem2;
}

with

> ./xgcc -B. t.c -O2 -g -gtoggle -fdump-tree-optimized -c

I get

;; Function foo (foo, funcdef_no=0, decl_uid=1979, cgraph_uid=1,
symbol_order=0)

int foo (int x)
{
  <bb 2> [local count: 1073741824]:
  return x_1(D);

}



;; Function bar (bar, funcdef_no=1, decl_uid=1984, cgraph_uid=2,
symbol_order=1)

__attribute__((optimize ("no-tree-pre")))
int bar (int x)
{
  <bb 2> [local count: 1073741824]:
  # DEBUG tem => x_1(D) + 1
  # DEBUG tem2 => x_1(D)
  return x_1(D);

}

so -gtoggle is not applied to 'bar'.  This works fine with GCC 11.

Reply via email to