From f53e7e138cf20f1a10fbcef2c14d838f494d4610 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 19 Apr 2018 09:46:54 +0200 Subject: [PATCH] re PR tree-optimization/85446 (wrong-code on riscv64) PR tree-optimization/85446 * match.pd ((intptr_t) x eq/ne CST to x eq/ne (typeof x) cst): Require the integral and pointer types to have the same precision. From-SVN: r259488 --- gcc/ChangeLog | 4 ++++ gcc/match.pd | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0e028045342..0fa244affc9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2018-04-19 Jakub Jelinek + PR tree-optimization/85446 + * match.pd ((intptr_t) x eq/ne CST to x eq/ne (typeof x) cst): Require + the integral and pointer types to have the same precision. + * doc/install.texi: Document --disable-cet being the default and --enable-cet=auto. diff --git a/gcc/match.pd b/gcc/match.pd index 1bbf09f96f0..442aad15e2c 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -3711,10 +3711,13 @@ 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)) && !FUNC_OR_METHOD_TYPE_P (TREE_TYPE (TREE_TYPE (@0))) - && INTEGRAL_TYPE_P (TREE_TYPE (@1))) - || (INTEGRAL_TYPE_P (TREE_TYPE (@0)) && POINTER_TYPE_P (TREE_TYPE (@1)) - && !FUNC_OR_METHOD_TYPE_P (TREE_TYPE (TREE_TYPE (@1))))) + (if (((POINTER_TYPE_P (TREE_TYPE (@0)) + && !FUNC_OR_METHOD_TYPE_P (TREE_TYPE (TREE_TYPE (@0))) + && INTEGRAL_TYPE_P (TREE_TYPE (@1))) + || (INTEGRAL_TYPE_P (TREE_TYPE (@0)) + && POINTER_TYPE_P (TREE_TYPE (@1)) + && !FUNC_OR_METHOD_TYPE_P (TREE_TYPE (TREE_TYPE (@1))))) + && TYPE_PRECISION (TREE_TYPE (@0)) == TYPE_PRECISION (TREE_TYPE (@1))) (cmp @0 (convert @1))))) /* Non-equality compare simplifications from fold_binary */ -- 2.30.2