------- Comment #4 from jakub at gcc dot gnu dot org 2009-09-23 11:26 ------- Ah, the problem is that targetm.calls.static_chain is called even on function decls which have decl_function_context (fndecl) == NULL, and those have undefined the DECL_NO_STATIC_CHAIN bit, as tree-nested.c only sets it when actually doing something.
So, either we could set DECL_NO_STATIC_CHAIN in tree-nested.c for functions which are not nested, or static_chain hooks should also return NULL immediately if a function isn't nested, or at least i386 hook shouldn't change the calling convention of the function if it isn't nested. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41436