diff options
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index aaae9d6..fc72b9b 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -13117,6 +13117,13 @@ fold_ternary (enum tree_code code, tree type, tree op0, tree op1, tree op2) return fold_convert (type, integer_zero_node); } } + + /* A bit-field-ref that referenced the full argument can be stripped. */ + if (INTEGRAL_TYPE_P (TREE_TYPE (arg0)) + && TYPE_PRECISION (TREE_TYPE (arg0)) == tree_low_cst (arg1, 1) + && integer_zerop (op2)) + return fold_convert (type, arg0); + return NULL_TREE; default: |