diff options
author | Richard Henderson <rth@redhat.com> | 2004-12-19 03:51:36 +0000 |
---|---|---|
committer | Richard Henderson <rth@redhat.com> | 2004-12-19 03:51:36 +0000 |
commit | 9bbd8bc954a74aed614113ae645c1f002da59b27 (patch) | |
tree | 179abc94a28b4e9128eb4a831fb962539750f0de /gcc/c-decl.c | |
parent | 1e65f8ce87e2533594b74ca7583f646646d0a1a4 (diff) |
* c-decl.c (grokdeclarator): Save variable array size before
subtracting 1, rather than after.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@92370 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index b728a6b3faa..b76e2746d99 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -4084,6 +4084,12 @@ grokdeclarator (const struct c_declarator *declarator, } 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 - 1. Do the calculation in index_type, so that if it is a variable the computations will be @@ -4107,8 +4113,6 @@ grokdeclarator (const struct c_declarator *declarator, continue; } - if (size_varies) - itype = variable_size (itype); itype = build_index_type (itype); } } |