aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorOlivier Hainque <hainque@adacore.com>2008-05-14 15:05:16 +0000
committerOlivier Hainque <hainque@gcc.gnu.org>2008-05-14 15:05:16 +0000
commitda19297d259fcb78814efb18314a7948a1cc0d15 (patch)
tree0858aef5f3aa63b8939b44ff482ee04774554ee9 /gcc/expr.c
parent1fd03c702134e610ffa87e5bb380606e14a6dc81 (diff)
downloadgcc-da19297d259fcb78814efb18314a7948a1cc0d15.zip
gcc-da19297d259fcb78814efb18314a7948a1cc0d15.tar.gz
gcc-da19297d259fcb78814efb18314a7948a1cc0d15.tar.bz2
expr.c (expand_expr_real_1): Force op0 to memory if the component is to be referenced in BLKmode according...
* expr.c (expand_expr_real_1) <normal_inner_ref>: Force op0 to memory if the component is to be referenced in BLKmode according to get_inner_reference. testsuite/ * gnat.dg/blkextract_from_reg.adb: New test. From-SVN: r135296
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index d2fc6d0..0bf8238 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7739,13 +7739,15 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
/* If this is a constant, put it into a register if it is a legitimate
constant, OFFSET is 0, and we won't try to extract outside the
register (in case we were passed a partially uninitialized object
- or a view_conversion to a larger size). Force the constant to
- memory otherwise. */
+ or a view_conversion to a larger size) or a BLKmode piece of it
+ (e.g. if it is unchecked-converted to a record type in Ada). Force
+ the constant to memory otherwise. */
if (CONSTANT_P (op0))
{
enum machine_mode mode = TYPE_MODE (TREE_TYPE (tem));
if (mode != BLKmode && LEGITIMATE_CONSTANT_P (op0)
&& offset == 0
+ && mode1 != BLKmode
&& bitpos + bitsize <= GET_MODE_BITSIZE (mode))
op0 = force_reg (mode, op0);
else
@@ -7759,8 +7761,9 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
for an ARRAY_RANGE_REF whose type is BLKmode. */
else if (!MEM_P (op0)
&& (offset != 0
- || (bitpos + bitsize > GET_MODE_BITSIZE (GET_MODE (op0)))
- || (code == ARRAY_RANGE_REF && mode == BLKmode)))
+ || mode1 == BLKmode
+ || (bitpos + bitsize
+ > GET_MODE_BITSIZE (GET_MODE (op0)))))
{
tree nt = build_qualified_type (TREE_TYPE (tem),
(TYPE_QUALS (TREE_TYPE (tem))