This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

static inline functions disappear - incorrect static initialiseranalysis?


Hi all,

I maintain a port of gcc for a 16-bit VLIW processor. For the last few months the port has been based on 3.4.1, but I've just decided to upgrade to gcc 4.0.0 branch. I've now got my port to compile with the latest code from the branch, and I'm doing regression tests. I've come across a problem which I can't figure out. Consider the following code fragment:

static inline void fn(void) { }

int main() {
 fn();
 return 0;
}

In the past, if I compiled without optimisation then `fn' would not be inlined, and main would contain a call to it. The assembly code for main would contain a reference to `fn', which would result in assemble_name being called, and would consequently result in `fn' being marked as referenced. This in turn would force gcc to emit a body for `fn'.

This no longer appears to be the case? `assemble_name' is still called with `fn', and correctly marks `fn' as being referenced, but no body is ever emitted. Do I now need to do something more than just calling assemble_name to get gcc to output the function body in such a case? I notice that the following comment appears in cgraphunit.c, in decide_is_function_needed:

 /* ??? If the assembler name is set by hand, it is possible to assemble
    the name later after finalizing the function and the fact is noticed
    in assemble_name then.  This is arguably a bug.  */

Is this the bug that I am experiencing, and does anyone know how I might work around it?

thanks,

dan.

============================================================================
Daniel Towner
picoChip Designs Ltd., Riverside Buildings, 108, Walcot Street, BATH,
BA1 5BG
daniel.towner@picochip.com
07786 702589




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]