From: Jan Hubicka Date: Mon, 4 May 2015 00:14:47 +0000 (+0200) Subject: * tree.c (verify_type): Check various uses of TYPE_MINVAL. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=30a9f69b59d900d9de42b678f5b32cce376ac952;p=gcc.git * tree.c (verify_type): Check various uses of TYPE_MINVAL. From-SVN: r222753 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 56d9d5d28ba..38ed17754f7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2015-05-02 Jan Hubicka + + * tree.c (verify_type): Check various uses of TYPE_MINVAL. + 2015-05-02 Trevor Saunders * tree-outof-ssa.c (emit_partition_copy): Return rtx_insn *. diff --git a/gcc/tree.c b/gcc/tree.c index 15d94a3f3f4..b9bf35dfa76 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -12584,15 +12584,60 @@ verify_type (const_tree t) } else if (t != mv && !verify_type_variant (t, mv)) error_found = true; - /* FIXME: C FE uses TYPE_VFIELD to record C_TYPE_INCOMPLETE_VARS - and danagle the pointer from time to time. */ - if (RECORD_OR_UNION_TYPE_P (t) && TYPE_VFIELD (t) - && TREE_CODE (TYPE_VFIELD (t)) != FIELD_DECL - && TREE_CODE (TYPE_VFIELD (t)) != TREE_LIST) + + /* Check various uses of TYPE_MINVAL. */ + if (RECORD_OR_UNION_TYPE_P (t)) + { + /* FIXME: C FE uses TYPE_VFIELD to record C_TYPE_INCOMPLETE_VARS + and danagle the pointer from time to time. */ + if (TYPE_VFIELD (t) + && TREE_CODE (TYPE_VFIELD (t)) != FIELD_DECL + && TREE_CODE (TYPE_VFIELD (t)) != TREE_LIST) + { + error ("TYPE_VFIELD is not FIELD_DECL nor TREE_LIST"); + debug_tree (TYPE_VFIELD (t)); + error_found = true; + } + } + else if (TREE_CODE (t) == POINTER_TYPE) + { + if (TYPE_NEXT_PTR_TO (t) + && TREE_CODE (TYPE_NEXT_PTR_TO (t)) != POINTER_TYPE) + { + error ("TYPE_NEXT_PTR_TO is not POINTER_TYPE"); + debug_tree (TYPE_NEXT_PTR_TO (t)); + error_found = true; + } + } + else if (TREE_CODE (t) == REFERENCE_TYPE) { - error ("TYPE_VFIELD is not FIELD_DECL nor TREE_LIST"); - debug_tree (TYPE_VFIELD (t)); + if (TYPE_NEXT_REF_TO (t) + && TREE_CODE (TYPE_NEXT_REF_TO (t)) != REFERENCE_TYPE) + { + error ("TYPE_NEXT_REF_TO is not REFERENCE_TYPE"); + debug_tree (TYPE_NEXT_REF_TO (t)); + error_found = true; + } + } + 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; + } + } + else if (TYPE_MINVAL (t)) + { + error ("TYPE_MINVAL non-NULL"); + debug_tree (TYPE_MINVAL (t)); + error_found = true; } + + if (error_found) { debug_tree (const_cast (t));