From: Jan Hubicka Date: Tue, 5 May 2015 01:42:07 +0000 (+0200) Subject: tree.c (verify_type): Check various uses of TYPE_MAXVAL... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=417402b80e0214008d7579a8a83d2b2e42c5d1a3;p=gcc.git tree.c (verify_type): Check various uses of TYPE_MAXVAL... * tree.c (verify_type): Check various uses of TYPE_MAXVAL; fix overactive TYPE_MIN_VALUE check and add FIXME for type compatibility problems. From-SVN: r222792 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce501cac13d..2ee441424f3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-05-02 Jan Hubicka + + * tree.c (verify_type): Check various uses of TYPE_MAXVAL; + fix overactive TYPE_MIN_VALUE check and add FIXME for type + compatibility problems. + 2015-05-04 Ajit Agarwal * config/microblaze/microblaze.md (cbranchsi4): Added immediate diff --git a/gcc/tree.c b/gcc/tree.c index b9bf35dfa76..c9e78ddc230 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -12621,14 +12621,9 @@ verify_type (const_tree t) } else if (INTEGRAL_TYPE_P (t) || TREE_CODE (t) == REAL_TYPE || TREE_CODE (t) == FIXED_POINT_TYPE) { - if (!TYPE_MIN_VALUE (t)) - ; - else if (!TREE_CONSTANT (TYPE_MIN_VALUE (t))) - { - error ("TYPE_MIN_VALUE is not constant"); - debug_tree (TYPE_MIN_VALUE (t)); - error_found = true; - } + /* FIXME: The following check should pass: + useless_type_conversion_p (const_cast (t), TREE_TYPE (TYPE_MIN_VALUE (t)) + bud does not for C sizetypes in LTO. */ } else if (TYPE_MINVAL (t)) { @@ -12637,6 +12632,62 @@ verify_type (const_tree t) error_found = true; } + /* Check various uses of TYPE_MAXVAL. */ + if (RECORD_OR_UNION_TYPE_P (t)) + { + if (TYPE_METHODS (t) && TREE_CODE (TYPE_METHODS (t)) != FUNCTION_DECL + && TREE_CODE (TYPE_METHODS (t)) != TEMPLATE_DECL) + { + error ("TYPE_METHODS is not FUNCTION_DECL nor TEMPLATE_DECL"); + debug_tree (TYPE_METHODS (t)); + error_found = true; + } + } + else if (TREE_CODE (t) == FUNCTION_TYPE || TREE_CODE (t) == METHOD_TYPE) + { + if (TYPE_METHOD_BASETYPE (t) + && TREE_CODE (TYPE_METHOD_BASETYPE (t)) != RECORD_TYPE + && TREE_CODE (TYPE_METHOD_BASETYPE (t)) != UNION_TYPE) + { + error ("TYPE_METHOD_BASETYPE is not record nor union"); + debug_tree (TYPE_METHOD_BASETYPE (t)); + error_found = true; + } + } + else if (TREE_CODE (t) == OFFSET_TYPE) + { + if (TYPE_OFFSET_BASETYPE (t) + && TREE_CODE (TYPE_OFFSET_BASETYPE (t)) != RECORD_TYPE + && TREE_CODE (TYPE_OFFSET_BASETYPE (t)) != UNION_TYPE) + { + error ("TYPE_OFFSET_BASETYPE is not record nor union"); + debug_tree (TYPE_OFFSET_BASETYPE (t)); + error_found = true; + } + } + else if (INTEGRAL_TYPE_P (t) || TREE_CODE (t) == REAL_TYPE || TREE_CODE (t) == FIXED_POINT_TYPE) + { + /* FIXME: The following check should pass: + useless_type_conversion_p (const_cast (t), TREE_TYPE (TYPE_MAX_VALUE (t)) + bud does not for C sizetypes in LTO. */ + } + else if (TREE_CODE (t) == ARRAY_TYPE) + { + if (TYPE_ARRAY_MAX_SIZE (t) + && TREE_CODE (TYPE_ARRAY_MAX_SIZE (t)) != INTEGER_CST) + { + error ("TYPE_ARRAY_MAX_SIZE not INTEGER_CST"); + debug_tree (TYPE_ARRAY_MAX_SIZE (t)); + error_found = true; + } + } + else if (TYPE_MAXVAL (t)) + { + error ("TYPE_MAXVAL non-NULL"); + debug_tree (TYPE_MAXVAL (t)); + error_found = true; + } + if (error_found) {