Hi, The attached patch fixes pr22051-2.c which regressed due to r238754. Matthew, could you please confirm if this patch fixes the test-case for you ?
Bootstrapped and tested on x86_64-unknown-linux-gnu. Cross tested on arm*-*-*. OK for trunk ? Thanks, Prathamesh
2016-08-04 Prathamesh Kulkarni <prathamesh.kulka...@linaro.org> * match.pd ((intptr_t) x eq/ne CST to x eq/ne (typeof x) cst): Disable transform if operand's type is pointer to function. diff --git a/gcc/match.pd b/gcc/match.pd index 2380d90..9b97aac 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -2532,8 +2532,10 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (for cmp (ne eq) (simplify (cmp (convert @0) INTEGER_CST@1) - (if ((POINTER_TYPE_P (TREE_TYPE (@0)) && INTEGRAL_TYPE_P (TREE_TYPE (@1))) - || (INTEGRAL_TYPE_P (TREE_TYPE (@0)) && POINTER_TYPE_P (TREE_TYPE (@1)))) + (if ((POINTER_TYPE_P (TREE_TYPE (@0)) && !FUNCTION_POINTER_TYPE_P (TREE_TYPE (@0)) + && INTEGRAL_TYPE_P (TREE_TYPE (@1))) + || (INTEGRAL_TYPE_P (TREE_TYPE (@0)) && POINTER_TYPE_P (TREE_TYPE (@1)) + && !FUNCTION_POINTER_TYPE_P (TREE_TYPE (@1)))) (cmp @0 (convert @1))))) /* Non-equality compare simplifications from fold_binary */