From: Richard Kenner Date: Fri, 10 Feb 1995 22:37:38 +0000 (-0500) Subject: (store_constructor, ARRAY_TYPE): Use code for non-integer INDEX for non-integer ELTTY... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5b6c44ffbc36973038d69741d9647876b06e7920;p=gcc.git (store_constructor, ARRAY_TYPE): Use code for non-integer INDEX for non-integer ELTTYPE size. (store_constructor, ARRAY_TYPE): Use code for non-integer INDEX for non-integer ELTTYPE size. Allow INDEX to be zero in code and divide size by BITS_PER_UNIT. From-SVN: r8902 --- diff --git a/gcc/expr.c b/gcc/expr.c index 6034a46c7de..f810a25b1f8 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -3070,14 +3070,18 @@ store_constructor (exp, target) bitsize = GET_MODE_BITSIZE (mode); unsignedp = TREE_UNSIGNED (elttype); - if (index != 0 && TREE_CODE (index) != INTEGER_CST) + if ((index != 0 && TREE_CODE (index) != INTEGER_CST) + || TREE_CODE (TYPE_SIZE (elttype)) != INTEGER_CST) { - /* We don't currently allow variable indices in a - C initializer, but let's try here to support them. */ rtx pos_rtx, addr, xtarget; tree position; - position = size_binop (MULT_EXPR, index, TYPE_SIZE (elttype)); + if (index == 0) + index = size_int (i); + + position = size_binop (EXACT_DIV_EXPR, TYPE_SIZE (elttype), + size_int (BITS_PER_UNIT)); + position = size_binop (MULT_EXPR, index, position); pos_rtx = expand_expr (position, 0, VOIDmode, 0); addr = gen_rtx (PLUS, Pmode, XEXP (target, 0), pos_rtx); xtarget = change_address (target, mode, addr);