aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2015-05-05 03:42:07 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2015-05-05 01:42:07 +0000
commit417402b80e0214008d7579a8a83d2b2e42c5d1a3 (patch)
treeea268b30eb02f1f8ae41e1669b6b5f2030d33320 /gcc/tree.c
parent2bdf1dd58b6a19f34898e324c587c6ad3f291da1 (diff)
downloadgcc-417402b80e0214008d7579a8a83d2b2e42c5d1a3.zip
gcc-417402b80e0214008d7579a8a83d2b2e42c5d1a3.tar.gz
gcc-417402b80e0214008d7579a8a83d2b2e42c5d1a3.tar.bz2
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
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c67
1 files changed, 59 insertions, 8 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index b9bf35d..c9e78dd 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 <tree> (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 <tree> (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)
{