------- Comment #5 from thutt at vmware dot com 2007-03-26 15:40 ------- I'm going to argue that comment #4 is incorrect.
1. This new behavior is a regression from previous versions of gcc. 2. The 4.1.1 compiler gets it right at -O0 and -O3. Previous versions of gcc which we've been using also get this right at all optimization levels. 3. The function is 'static', not '__attribute__((inline))'. The use of static doesn't implicitly give the optimizer permission to inline the function, it only declares the linkage to be 'internal'. However, if the compiler determines that the function meets certain criteria, such as being static and not having its address taken, then it *can* inline it. These 'certain criteria' should be expanded to include changing the section of a function; if it's not in the default text section, it shouldn't be inlined. (Of course, this shouldn't impact gcc's internal garbage collection mechanism of changing function & data sections). In the actual implementation from which this test case was derived, the function *must* reside at a specific location in memory, but due to the inlining, it does not. This causes failures in the application. -- thutt at vmware dot com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|INVALID | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31362