summaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-11 15:48:39 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-11 15:48:39 +0000
commit1795103a5f47d1050c9a60ba0ef8939675c1a68b (patch)
tree07c7168ba1f0b818b361c11b91ce9c3c290414d3 /gcc/expr.c
parent05b432eae9a2494e7083bf0b8c51f2c1e8654af4 (diff)
downloadgcc-1795103a5f47d1050c9a60ba0ef8939675c1a68b.tar.gz
PR middle-end/46388
* expr.c (expand_assignment): If to_rtx is a VOIDmode MEM, use BLKmode mode for it. (expand_expr_real_1): Similarly for op0. * gcc.c-torture/compile/pr46388.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166603 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index cb73f01f28c..d2aefd5d763 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -4260,11 +4260,16 @@ expand_assignment (tree to, tree from, bool nontemporal)
to_rtx = expand_normal (tem);
/* If the bitfield is volatile, we want to access it in the
- field's mode, not the computed mode. */
- if (volatilep
- && GET_CODE (to_rtx) == MEM
- && flag_strict_volatile_bitfields > 0)
- to_rtx = adjust_address (to_rtx, mode1, 0);
+ field's mode, not the computed mode.
+ If a MEM has VOIDmode (external with incomplete type),
+ use BLKmode for it instead. */
+ if (MEM_P (to_rtx))
+ {
+ if (volatilep && flag_strict_volatile_bitfields > 0)
+ to_rtx = adjust_address (to_rtx, mode1, 0);
+ else if (GET_MODE (to_rtx) == VOIDmode)
+ to_rtx = adjust_address (to_rtx, BLKmode, 0);
+ }
if (offset != 0)
{
@@ -9013,11 +9018,16 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
/* If the bitfield is volatile, we want to access it in the
- field's mode, not the computed mode. */
- if (volatilep
- && GET_CODE (op0) == MEM
- && flag_strict_volatile_bitfields > 0)
- op0 = adjust_address (op0, mode1, 0);
+ field's mode, not the computed mode.
+ If a MEM has VOIDmode (external with incomplete type),
+ use BLKmode for it instead. */
+ if (MEM_P (op0))
+ {
+ if (volatilep && flag_strict_volatile_bitfields > 0)
+ op0 = adjust_address (op0, mode1, 0);
+ else if (GET_MODE (op0) == VOIDmode)
+ op0 = adjust_address (op0, BLKmode, 0);
+ }
mode2
= CONSTANT_P (op0) ? TYPE_MODE (TREE_TYPE (tem)) : GET_MODE (op0);