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: unassig...@gcc.gnu.org

        ReportedBy: y...@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();

}

Reply via email to