aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2021-05-11 13:58:48 -0600
committerMartin Sebor <msebor@redhat.com>2021-05-11 13:58:48 -0600
commitde09c0ddb81e2dc0e35c2e362532e93ca417200c (patch)
treebb41e2f9afb5bd60a6a7fd1f6608f318dfdf8d9a /gcc/expr.c
parent3e3fdf3d5217e5a2d075ca399b557b2e886dcd18 (diff)
downloadgcc-de09c0ddb81e2dc0e35c2e362532e93ca417200c.zip
gcc-de09c0ddb81e2dc0e35c2e362532e93ca417200c.tar.gz
gcc-de09c0ddb81e2dc0e35c2e362532e93ca417200c.tar.bz2
Replace unreachable code with an assert.
Resolves: PR middle-end/21433 - The COMPONENT_REF case of expand_expr_real_1 is probably wrong gcc/ChangeLog: PR middle-end/21433 * expr.c (expand_expr_real_1): Replace unreachable code with an assert.
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c57
1 files changed, 2 insertions, 55 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 1b65f6b..d09ee42 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -10949,61 +10949,8 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
goto normal_inner_ref;
case COMPONENT_REF:
- /* If the operand is a CONSTRUCTOR, we can just extract the
- appropriate field if it is present. */
- if (TREE_CODE (treeop0) == CONSTRUCTOR)
- {
- unsigned HOST_WIDE_INT idx;
- tree field, value;
- scalar_int_mode field_mode;
-
- FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (treeop0),
- idx, field, value)
- if (field == treeop1
- /* We can normally use the value of the field in the
- CONSTRUCTOR. However, if this is a bitfield in
- an integral mode that we can fit in a HOST_WIDE_INT,
- we must mask only the number of bits in the bitfield,
- since this is done implicitly by the constructor. If
- the bitfield does not meet either of those conditions,
- we can't do this optimization. */
- && (! DECL_BIT_FIELD (field)
- || (is_int_mode (DECL_MODE (field), &field_mode)
- && (GET_MODE_PRECISION (field_mode)
- <= HOST_BITS_PER_WIDE_INT))))
- {
- if (DECL_BIT_FIELD (field)
- && modifier == EXPAND_STACK_PARM)
- target = 0;
- op0 = expand_expr (value, target, tmode, modifier);
- if (DECL_BIT_FIELD (field))
- {
- HOST_WIDE_INT bitsize = TREE_INT_CST_LOW (DECL_SIZE (field));
- scalar_int_mode imode
- = SCALAR_INT_TYPE_MODE (TREE_TYPE (field));
-
- if (TYPE_UNSIGNED (TREE_TYPE (field)))
- {
- op1 = gen_int_mode ((HOST_WIDE_INT_1 << bitsize) - 1,
- imode);
- op0 = expand_and (imode, op0, op1, target);
- }
- else
- {
- int count = GET_MODE_PRECISION (imode) - bitsize;
-
- op0 = expand_shift (LSHIFT_EXPR, imode, op0, count,
- target, 0);
- op0 = expand_shift (RSHIFT_EXPR, imode, op0, count,
- target, 0);
- }
- }
-
- return op0;
- }
- }
- goto normal_inner_ref;
-
+ gcc_assert (TREE_CODE (treeop0) != CONSTRUCTOR);
+ /* Fall through. */
case BIT_FIELD_REF:
case ARRAY_RANGE_REF:
normal_inner_ref: