http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47237
Summary: builtin_apply_args broken WRT local API changes. Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: hubi...@gcc.gnu.org #define INTEGER_ARG 5 extern void abort(void); static void foo(int arg) { if (arg != INTEGER_ARG) abort(); } static void bar(int arg) { foo(arg); __builtin_apply(foo, __builtin_apply_args(), 16); } int main(void) { bar(INTEGER_ARG); return 0; } fails at 32bit. The problem is that we call bar with register calling conventions, while foo's calling conventions are default. We must prevent any call conventions changes on functions calling builtlin_apply. This is not only case where builtin_apply_args breaks, since we will happily clone the functions, too. I guess in addition to inlinable and cloning flag, we need flag whether function calling convention can change. In what conditions this is false in addition to apply_args? This bug probably exists since GCC 3.4. I tested 4.3 and 4.5 to fail.