Summary: | Inlining fails for functions with const parameters | ||
---|---|---|---|
Product: | GDC | Reporter: | Johannes Pfau <johannespfau> |
Component: | gdc | Assignee: | Iain Buclaw <ibuclaw> |
Status: | RESOLVED FIXED | ||
Severity: | minor | ||
Priority: | --- | ||
Version: | development | ||
Hardware: | x86_64 | ||
OS: | Linux |
When you say force inlining, I take it you mean you are doing some trickery in the debugger. :-) No, that error message was also reported by jerro and he added some pragma(always_inline) implementation to his copy of gdc. The error is reported either from ipa-inline.c or from ipa-inline-analysis.c, grep for "CIF_MISMATCHED_ARGUMENTS". Both check for call_stmt_cannot_inline_p which is probably set in ipa-inline.c: if (edge->callee->symbol.decl && !gimple_check_call_matching_types (edge->call_stmt, edge->callee->symbol.decl)) edge->call_stmt_cannot_inline_p = true; gimple_check_call_matching_types is declared in gimple-low.c That's lovely. always_inline attribute has been removed from the set of available pragmas. Actually I might remove all gcc-related pragmas in the near future and replace with @attributes instead. But that's open for discussion on how best to proceed. |
gdc/gcc fails to inline bar in this example: > struct S > { > int bar(const S s) > { > return 0; > } > } > > int foo() > { > S s; > return s.bar(s); > } compile with -c -O3 -finline-functions -frelease When forcing inlining, this is the error message: error: inlining failed in call to always_inline ?main.Julia!(float).ComplexStruct.squarePlusMag?: mismatched arguments Reported by jerro in the gdc newsgroup.