diff options
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 6573702..7c2ee78 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -4134,6 +4134,53 @@ verify_gimple_assign_ternary (gassign *stmt) return false; + case BIT_INSERT_EXPR: + if (! useless_type_conversion_p (lhs_type, rhs1_type)) + { + error ("type mismatch in BIT_INSERT_EXPR"); + debug_generic_expr (lhs_type); + debug_generic_expr (rhs1_type); + return true; + } + if (! ((INTEGRAL_TYPE_P (rhs1_type) + && INTEGRAL_TYPE_P (rhs2_type)) + || (VECTOR_TYPE_P (rhs1_type) + && types_compatible_p (TREE_TYPE (rhs1_type), rhs2_type)))) + { + error ("not allowed type combination in BIT_INSERT_EXPR"); + debug_generic_expr (rhs1_type); + debug_generic_expr (rhs2_type); + return true; + } + if (! tree_fits_uhwi_p (rhs3) + || ! tree_fits_uhwi_p (TYPE_SIZE (rhs2_type))) + { + error ("invalid position or size in BIT_INSERT_EXPR"); + return true; + } + if (INTEGRAL_TYPE_P (rhs1_type)) + { + unsigned HOST_WIDE_INT bitpos = tree_to_uhwi (rhs3); + if (bitpos >= TYPE_PRECISION (rhs1_type) + || (bitpos + TYPE_PRECISION (rhs2_type) + > TYPE_PRECISION (rhs1_type))) + { + error ("insertion out of range in BIT_INSERT_EXPR"); + return true; + } + } + else if (VECTOR_TYPE_P (rhs1_type)) + { + unsigned HOST_WIDE_INT bitpos = tree_to_uhwi (rhs3); + unsigned HOST_WIDE_INT bitsize = tree_to_uhwi (TYPE_SIZE (rhs2_type)); + if (bitpos % bitsize != 0) + { + error ("vector insertion not at element boundary"); + return true; + } + } + return false; + case DOT_PROD_EXPR: case REALIGN_LOAD_EXPR: /* FIXME. */ |