diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-05-31 17:42:10 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-05-31 17:42:10 +0200 |
commit | 6a866023b73e83b4cd3692b3655ad0522fddddaa (patch) | |
tree | b716fddb474b0e91db60b56b8c1b3b22c5fde518 | |
parent | 90a7788bbc9890f681aa8434a861d88c3a9eb815 (diff) | |
download | gcc-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
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/expr.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr44337.c | 10 |
4 files changed, 29 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 30fe267e..809ccb8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2010-05-31 Jakub Jelinek <jakub@redhat.com> + PR middle-end/44337 + * expr.c (expand_assignment): Don't store anything for out-of-bounds + array accesses with non-MEM. + PR tree-optimization/44182 * tree-inline.c (copy_edges_for_bb): Don't split bb if a stmt that newly needs to end a bb is followed by debug stmts, instead return @@ -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)))) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4dc9a41..abeee7e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2010-05-31 Jakub Jelinek <jakub@redhat.com> + PR middle-end/44337 + * gcc.dg/pr44337.c: New test. + PR tree-optimization/44182 * g++.dg/debug/pr44182.C: New test. diff --git a/gcc/testsuite/gcc.dg/pr44337.c b/gcc/testsuite/gcc.dg/pr44337.c new file mode 100644 index 0000000..57e0549 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr44337.c @@ -0,0 +1,10 @@ +/* PR middle-end/44337 */ +/* { dg-do compile } */ +/* { dg-options "-O -fno-tree-dce -fno-tree-dse -w" } */ + +void +foo (void) +{ + _Complex float v[1]; + v[1] = 0; +} |