aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@libertysurf.fr>2003-12-01 08:15:31 +0100
committerEric Botcazou <ebotcazou@gcc.gnu.org>2003-12-01 07:15:31 +0000
commite82407b5bb381e6940f8d4f1a4c218146acc1524 (patch)
tree43fd149070ddd68f998f0fbe7e3aa7ebea4728aa /gcc/expr.c
parenta668c6adec09839b44d2ae6c1046a2e100e10936 (diff)
downloadgcc-e82407b5bb381e6940f8d4f1a4c218146acc1524.zip
gcc-e82407b5bb381e6940f8d4f1a4c218146acc1524.tar.gz
gcc-e82407b5bb381e6940f8d4f1a4c218146acc1524.tar.bz2
re PR middle-end/7847 (pragma pack / attribute(packed): unaligned access to packed structure)
PR middle-end/7847 * expr.c (expand_expr) [normal_inner_ref]: When 'offset' is non-zero, do not recheck that 'op0' is a MEM. Move comment. When testing for unaligned objects, take also into account the alignment of 'op0' and 'mode1' if 'op0' is a MEM. From-SVN: r74092
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 79b9486..c013785 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7153,10 +7153,9 @@ expand_expr (tree exp, rtx target, enum machine_mode tmode,
offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 0);
#endif
- /* A constant address in OP0 can have VOIDmode, we must not try
- to call force_reg for that case. Avoid that case. */
- if (GET_CODE (op0) == MEM
- && GET_MODE (op0) == BLKmode
+ if (GET_MODE (op0) == BLKmode
+ /* A constant address in OP0 can have VOIDmode, we must
+ not try to call force_reg in that case. */
&& GET_MODE (XEXP (op0, 0)) != VOIDmode
&& bitsize != 0
&& (bitpos % bitsize) == 0
@@ -7213,7 +7212,10 @@ expand_expr (tree exp, rtx target, enum machine_mode tmode,
fetch it as a bit field. */
|| (mode1 != BLKmode
&& (((TYPE_ALIGN (TREE_TYPE (tem)) < GET_MODE_ALIGNMENT (mode)
- || (bitpos % GET_MODE_ALIGNMENT (mode) != 0))
+ || (bitpos % GET_MODE_ALIGNMENT (mode) != 0)
+ || (GET_CODE (op0) == MEM
+ && (MEM_ALIGN (op0) < GET_MODE_ALIGNMENT (mode1)
+ || (bitpos % GET_MODE_ALIGNMENT (mode1) != 0))))
&& ((modifier == EXPAND_CONST_ADDRESS
|| modifier == EXPAND_INITIALIZER)
? STRICT_ALIGNMENT