summaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-19 03:51:36 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-19 03:51:36 +0000
commit4bf5100142e80ebb621ba01962633f5fcea1c253 (patch)
tree179abc94a28b4e9128eb4a831fb962539750f0de /gcc/c-decl.c
parent9765e83bd9d2c6d588e3c2a77db02fc4a5818a7b (diff)
downloadgcc-4bf5100142e80ebb621ba01962633f5fcea1c253.tar.gz
* c-decl.c (grokdeclarator): Save variable array size before
subtracting 1, rather than after. git-svn-id: svn+ssh://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.c8
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);
}
}