+2008-05-10 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * tree-cfg.c (valid_fixed_convert_types_p): New function.
+ (verify_gimple_expr): Handle FIXED_CONVERT_EXPR.
+
2008-05-10 Uros Bizjak <ubizjak@gmail.com>
* value-prof.c (interesting_stringop_to_profile): Do not
return false;
}
+/* Return true if TYPE1 is a fixed-point type and if conversions to and
+ from TYPE2 can be handled by FIXED_CONVERT_EXPR. */
+
+static bool
+valid_fixed_convert_types_p (tree type1, tree type2)
+{
+ return (FIXED_POINT_TYPE_P (type1)
+ && (INTEGRAL_TYPE_P (type2)
+ || SCALAR_FLOAT_TYPE_P (type2)
+ || FIXED_POINT_TYPE_P (type2)));
+}
+
/* Verify the GIMPLE expression EXPR. Returns true if there is an
error, otherwise false. */
return false;
}
+ case FIXED_CONVERT_EXPR:
+ {
+ tree op = TREE_OPERAND (expr, 0);
+ if (!is_gimple_val (op))
+ {
+ error ("invalid operand in conversion");
+ return true;
+ }
+
+ if (!valid_fixed_convert_types_p (type, TREE_TYPE (op))
+ && !valid_fixed_convert_types_p (TREE_TYPE (op), type))
+ {
+ error ("invalid types in fixed-point conversion");
+ debug_generic_expr (type);
+ debug_generic_expr (TREE_TYPE (op));
+ return true;
+ }
+
+ return false;
+ }
+
case FLOAT_EXPR:
{
tree op = TREE_OPERAND (expr, 0);