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
This commit is contained in:
Jan Hubicka 2015-05-05 03:42:07 +02:00 committed by Jan Hubicka
parent 2bdf1dd58b
commit 417402b80e
2 changed files with 65 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2015-05-02 Jan Hubicka <hubicka@ucw.cz>
* 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 <ajitkum@xilinx.com>
* config/microblaze/microblaze.md (cbranchsi4): Added immediate

View File

@ -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)
{