Commit 8b0b9aef by Richard Henderson Committed by Richard Henderson

c-decl.c (grokdeclarator): Save variable array size before subtracting 1, rather than after.

        * c-decl.c (grokdeclarator): Save variable array size before
        subtracting 1, rather than after.

From-SVN: r92370
parent 00a68988
2004-12-18 Richard Henderson <rth@redhat.com>
* c-decl.c (grokdeclarator): Save variable array size before
subtracting 1, rather than after.
2004-12-18 Eric Botcazou <ebotcazou@libertysurf.fr> 2004-12-18 Eric Botcazou <ebotcazou@libertysurf.fr>
PR middle-end/15486 PR middle-end/15486
......
...@@ -4084,6 +4084,12 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4084,6 +4084,12 @@ grokdeclarator (const struct c_declarator *declarator,
} }
else else
{ {
/* Arrange for the SAVE_EXPR on the inside of the
MINUS_EXPR, which allows the -1 to get folded
with the +1 that happens when building TYPE_SIZE. */
if (size_varies)
size = variable_size (size);
/* Compute the maximum valid index, that is, size /* Compute the maximum valid index, that is, size
- 1. Do the calculation in index_type, so that - 1. Do the calculation in index_type, so that
if it is a variable the computations will be if it is a variable the computations will be
...@@ -4107,8 +4113,6 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4107,8 +4113,6 @@ grokdeclarator (const struct c_declarator *declarator,
continue; continue;
} }
if (size_varies)
itype = variable_size (itype);
itype = build_index_type (itype); itype = build_index_type (itype);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment