From: Jakub Jelinek Date: Mon, 31 May 2010 15:42:10 +0000 (+0200) Subject: re PR middle-end/44337 (ICE: in expand_assignment, at expr.c:4276) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6a866023b73e83b4cd3692b3655ad0522fddddaa;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 30fe267e3bb..809ccb8640e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2010-05-31 Jakub Jelinek + 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 diff --git a/gcc/expr.c b/gcc/expr.c index 82c03717209..6b2feb685a4 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)))) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4dc9a4158a3..abeee7e7f9b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2010-05-31 Jakub Jelinek + 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 00000000000..57e0549247f --- /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; +}