diff options
author | hainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-14 15:05:16 +0000 |
---|---|---|
committer | hainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-14 15:05:16 +0000 |
commit | 220144ca61f27a189dde29e2c1e8d0742bdd5167 (patch) | |
tree | 0858aef5f3aa63b8939b44ff482ee04774554ee9 /gcc/expr.c | |
parent | 34a0af1037936178e2439cb2bfff65d45cba73bb (diff) | |
download | ppe42-gcc-220144ca61f27a189dde29e2c1e8d0742bdd5167.tar.gz ppe42-gcc-220144ca61f27a189dde29e2c1e8d0742bdd5167.zip |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135296 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/expr.c b/gcc/expr.c index d2fc6d0cc5f..0bf82382400 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)) |