public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-728] Replace unreachable code with an assert.
@ 2021-05-11 20:00 Martin Sebor
0 siblings, 0 replies; only message in thread
From: Martin Sebor @ 2021-05-11 20:00 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:de09c0ddb81e2dc0e35c2e362532e93ca417200c
commit r12-728-gde09c0ddb81e2dc0e35c2e362532e93ca417200c
Author: Martin Sebor <msebor@redhat.com>
Date: Tue May 11 13:58:48 2021 -0600
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.
Diff:
---
gcc/expr.c | 57 ++-------------------------------------------------------
1 file changed, 2 insertions(+), 55 deletions(-)
diff --git a/gcc/expr.c b/gcc/expr.c
index 1b65f6b3245..d09ee42e262 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:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-11 20:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11 20:00 [gcc r12-728] Replace unreachable code with an assert Martin Sebor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).