summaryrefslogtreecommitdiff
path: root/gcc/gimple-fold.c
diff options
context:
space:
mode:
authormpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-17 14:51:56 +0000
committermpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-17 14:51:56 +0000
commita576c57a10976eb0a56b7ea9b5a2e7f7bdb2aa3f (patch)
tree07068f367f80f8bc0e8385c4425d17154f983d33 /gcc/gimple-fold.c
parent1941e89d79693bafc04d82dca8e1257a051ffc38 (diff)
downloadgcc-a576c57a10976eb0a56b7ea9b5a2e7f7bdb2aa3f.tar.gz
PR c/58346
* gimple-fold.c (fold_array_ctor_reference): Don't fold if element size is zero. testsuite/ * gcc.dg/pr58346.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206715 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r--gcc/gimple-fold.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 5dc27e172d9..bace6f892d2 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -2940,7 +2940,8 @@ fold_array_ctor_reference (tree type, tree ctor,
be larger than size of array element. */
if (!TYPE_SIZE_UNIT (type)
|| TREE_CODE (TYPE_SIZE_UNIT (type)) != INTEGER_CST
- || elt_size.slt (tree_to_double_int (TYPE_SIZE_UNIT (type))))
+ || elt_size.slt (tree_to_double_int (TYPE_SIZE_UNIT (type)))
+ || elt_size.is_zero ())
return NULL_TREE;
/* Compute the array index we look for. */