On Fri, Jan 03, 2014 at 11:01:13AM +0100, Richard Biener wrote:
> > Well, see PR59630. The question is if having to handle it everywhere
> > is worth it.
>
> Well, this case happens because we go back to GENERIC which doesn't
> have this feature. So "everywhere" is somewhat a broad stmt.
> It's easy to guard the builtins.c folding with a compatibility
> check of fntype and fndecl type.
Well, clearly the inliner has similar issue, I doubt e.g. IPA cloning
handles it right, there is just one gimple_call_fntype call in all of ipa*.c
(which surprises me) and that ignores it if there is a decl:
tree type = (e->callee
? TREE_TYPE (e->callee->decl)
: gimple_call_fntype (e->call_stmt));
so if there is a mismatch between TREE_TYPE (e->callee->decl) and
gimple_call_fntype, it will happily look at the decl type.
So I'd say it is just a matter of adding more (invalid) testcases.
Jakub