aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-05-31 17:42:10 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2010-05-31 17:42:10 +0200
commit6a866023b73e83b4cd3692b3655ad0522fddddaa (patch)
treeb716fddb474b0e91db60b56b8c1b3b22c5fde518 /gcc/expr.c
parent90a7788bbc9890f681aa8434a861d88c3a9eb815 (diff)
downloadgcc-6a866023b73e83b4cd3692b3655ad0522fddddaa.zip
gcc-6a866023b73e83b4cd3692b3655ad0522fddddaa.tar.gz
gcc-6a866023b73e83b4cd3692b3655ad0522fddddaa.tar.bz2
re PR middle-end/44337 (ICE: in expand_assignment, at expr.c:4276)
PR middle-end/44337 * expr.c (expand_assignment): Don't store anything for out-of-bounds array accesses with non-MEM. * gcc.dg/pr44337.c: New test. From-SVN: r160076
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 82c0371..6b2feb6 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -4268,8 +4268,19 @@ expand_assignment (tree to, tree from, bool nontemporal)
offset));
}
+ /* No action is needed if the target is not a memory and the field
+ lies completely outside that target. This can occur if the source
+ code contains an out-of-bounds access to a small array. */
+ if (!MEM_P (to_rtx)
+ && GET_MODE (to_rtx) != BLKmode
+ && (unsigned HOST_WIDE_INT) bitpos
+ >= GET_MODE_BITSIZE (GET_MODE (to_rtx)))
+ {
+ expand_normal (from);
+ result = NULL;
+ }
/* Handle expand_expr of a complex value returning a CONCAT. */
- if (GET_CODE (to_rtx) == CONCAT)
+ else if (GET_CODE (to_rtx) == CONCAT)
{
if (COMPLEX_MODE_P (TYPE_MODE (TREE_TYPE (from))))
{