diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2008-05-10 12:18:24 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2008-05-10 12:18:24 +0000 |
commit | 17d23165ffa88ad006418be8e1dcf5f649c6ff91 (patch) | |
tree | 797da7ce46cd913923e6a6663ce2a41b74a0f19d | |
parent | 0f418a86bd6efeb40469867acf02bdd64a3d77d4 (diff) | |
download | gcc-17d23165ffa88ad006418be8e1dcf5f649c6ff91.zip gcc-17d23165ffa88ad006418be8e1dcf5f649c6ff91.tar.gz gcc-17d23165ffa88ad006418be8e1dcf5f649c6ff91.tar.bz2 |
tree-cfg.c (valid_fixed_convert_types_p): New function.
gcc/
* tree-cfg.c (valid_fixed_convert_types_p): New function.
(verify_gimple_expr): Handle FIXED_CONVERT_EXPR.
From-SVN: r135143
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 33 |
2 files changed, 38 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b62535a..a8695c0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +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 diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 340c7a2..ed52826 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -3598,6 +3598,18 @@ one_pointer_to_useless_type_conversion_p (tree dest, tree src_obj) 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. */ @@ -3654,6 +3666,27 @@ verify_gimple_expr (tree expr) 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); |