Changing the fntype[2] looks wrong to me, as it is also used for powi(double, int) , where the argument order matches the current version:
> gfc_define_builtin ("__builtin_powi", mfunc_double[2], > BUILT_IN_POWI, "powi", ATTR_CONST_NOTHROW_LEAF_LIST); (I don’t see any other use of this, but I might be missing something.) It looks like fntype[5] is actually what you need, and it’s already constructed! However, there is even more mistery here, because it is currently used for __builtin_scalbn, which doesn’t seem right: http://pubs.opengroup.org/onlinepubs/009695399/functions/scalbln.html So I suspect looking a bit more in depth is required! Also, testcases that excercise this fndecl matching (which you would see fail on ptx) would be a great addition to the testsuite, once you commit (for powi & scalbn, which do not look covered right now, otherwise you would have seen regressions). Cheers, FX