diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1995-02-10 17:37:38 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1995-02-10 17:37:38 -0500 |
commit | 5b6c44ffbc36973038d69741d9647876b06e7920 (patch) | |
tree | 6d9b6794e6fc8ebc72077b8c9252a70e51816b22 /gcc | |
parent | cd7ece6611492426f2ef4030da4b564fd0b9aa10 (diff) | |
download | gcc-5b6c44ffbc36973038d69741d9647876b06e7920.zip gcc-5b6c44ffbc36973038d69741d9647876b06e7920.tar.gz gcc-5b6c44ffbc36973038d69741d9647876b06e7920.tar.bz2 |
(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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/expr.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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); |