http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59622
--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Ah, ok, the #c12 testcase is indeed a different case, targets doesn't have length 0 in that case, but length 1, but targets[0]->decl is __cxa_pure_virtual function, which is similar to __builtin_unreachable in that it takes no arguments, has void return value and is noreturn. So, supposedly for the length 1 case gimple_fold_call should compare if the return type is compatible with the lhs type if it has lhs, for !inplace just punt (similarly for the case (always?) when the number of arguments is bigger than the called one), for inplace I guess we can replace it by a different call but would need to do for the lhs what I mentioned (if it has lhs and the lhs has gimple_reg_type, set it to zero after the noreturn call with void type). For other incompatibilities in the return value or arguments, perhaps we should just not try to fold it at all.