[Bug c/56099] New: Empty static noinline functions aren't called from optimized code

yuri at tsoft dot com gcc-bugzilla@gcc.gnu.org
Thu Jan 24 18:41:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56099

             Bug #: 56099
           Summary: Empty static noinline functions aren't called from
                    optimized code
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: yuri@tsoft.com


The C testcase below, when compiled with gcc-4.7.1 with flag '-O2', doesn't
contain the noinline function at all. No body and no call.
gcc-4.2.1 did leave the body of such function, but also didn't have the call.

gcc should respect noinline attribute even on the empty functions and should
leave both body and call to it.

PS: I hit this while attempting to add the DTrace probes through adding of the
empty function. However, call to this function was never placed into code so
this technique doesn't work due to this bug.

---testcase---
__attribute__((noinline))
static int func_ni() {
  return 1;
}

void func_exp() {
  func_ni();
}



More information about the Gcc-bugs mailing list